Skip to content

Commit 4aa35c5

Browse files
authored
feat: change trigger command to comply with new endpoint (#7067)
1 parent a90980c commit 4aa35c5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.changeset/grumpy-eggs-rest.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Change trigger command to comply with the current workflows endpoint.
6+
7+
This also adds an id option to allow users to optionally customize the new instance id.

packages/wrangler/src/workflows/commands/trigger.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ defineCommand({
2424
type: "string",
2525
default: "",
2626
},
27+
id: {
28+
describe:
29+
"Custom instance ID, if not provided it will default to a random UUIDv4",
30+
type: "string",
31+
default: undefined,
32+
},
2733
},
2834
positionalArgs: ["name", "params"],
2935

@@ -45,7 +51,11 @@ defineCommand({
4551
`/accounts/${accountId}/workflows/${args.name}/instances`,
4652
{
4753
method: "POST",
48-
body: args.params.length != 0 ? args.params : undefined,
54+
headers: { "Content-Type": "application/json" },
55+
body: JSON.stringify({
56+
instance_id: args.id,
57+
params: args.params.length != 0 ? args.params : undefined,
58+
}),
4959
}
5060
);
5161

0 commit comments

Comments
 (0)