Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/silent-workflows-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"miniflare": patch
"wrangler": patch
---

Fix local Workflow startup when compatibility flags include `experimental`

Miniflare now deduplicates compatibility flags for the internal Workflow engine service. This prevents `wrangler dev` from failing with `Compatibility flag specified multiple times: experimental` when the user's Worker already enables that flag.
7 changes: 3 additions & 4 deletions packages/miniflare/src/plugins/workflows/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,9 @@ export const WORKFLOWS_PLUGIN: Plugin<
),
worker: {
compatibilityDate: "2024-10-22",
compatibilityFlags: [
"experimental",
...(workflow.compatibilityFlags ?? []),
],
compatibilityFlags: Array.from(
new Set(["experimental", ...(workflow.compatibilityFlags ?? [])])
Comment thread
zebp marked this conversation as resolved.
),
modules: [
{
name: "workflows.mjs",
Expand Down
30 changes: 30 additions & 0 deletions packages/miniflare/test/plugins/workflows/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,36 @@ export class MyWorkflow extends WorkflowEntrypoint {
},
};`;

test("starts Workflows with user-provided experimental compatibility flag", async ({
expect,
}) => {
const tmp = await useTmp();
const mf = new Miniflare({
name: "workflow-compatibility-flags-worker",
compatibilityDate: "2024-11-20",
modules: true,
script: WORKFLOW_SCRIPT(),
workflows: {
MY_WORKFLOW: {
className: "MyWorkflow",
name: "MY_WORKFLOW",
compatibilityFlags: [
"nodejs_compat",
"experimental",
"enhanced_error_serialization",
],
},
},
Comment thread
zebp marked this conversation as resolved.
workflowsPersist: tmp,
});
useDispose(mf);

const res = await mf.dispatchFetch("http://localhost");
expect(await res.text()).toBe(
'{"status":"complete","__LOCAL_DEV_STEP_OUTPUTS":["yes you are"],"output":"I\'m a output string"}'
);
});

test("persists Workflow data on file-system between runs", async ({
expect,
}) => {
Expand Down
Loading