fix: preserve Nitro workflow step registration side effects#1386
Conversation
🦋 Changeset detectedLatest commit: a536418 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@comfuture is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
@VaguelySerious @pi0 what do you think? |
|
LGTM if it is delibrate to even have side effects... Is there any backstory to this? (why we need side-effects?) |
|
Hey @comfuture, could you ensure this check passes? And also add a comment as to what issue you were seeing concretely that was solved through this PR. Once that's done, we'll run e2e tests and merge the PR |
Signed-off-by: comfuture <comfuture@gmail.com>
Signed-off-by: comfuture <comfuture@gmail.com>
Signed-off-by: comfuture <comfuture@gmail.com>
2d6de62 to
04ac256
Compare
Thanks. I fixed the check that was failing there; it was the DCO check, and it now passes. In that setup, the generated This change keeps a bare import of the generated steps module so those registration side effects are preserved. |
|
Just a note, next nitro v3 release will have less agressive tree-shaking config (currently available in nightly) worth to check if after we still need this fix or not. More info: nitrojs/nitro#4164 |
|
@pi0 Merged for now and will add a comment mentioning that this fix could maybe be reverted after nitrojs/nitro#4164 |
…1-refresh * origin/main: (21 commits) Fix node-module-error plugin matching identifiers in multi-line comments (#1554) fix(swc-plugin): use binding name for class expression method registrations (#1599) fix(builders): override `sideEffects: false` for discovered workflow/step/serde entries (#1598) [world-vercel] align header names to `x-vercel-workflow-*` convention (#1602) [docs] Add vercel world consumer function security documentation (#1543) Make `start()` types `unknown` when `deploymentId` is provided (#1367) fix(next): stop force-setting WORKFLOW_PUBLIC_MANIFEST=1 during next dev (#1597) Version Packages (beta) (#1593) [docs] Tidy world API docs and document new stream helpers (#1581) Rename 'Workflow Development Kit' / 'DevKit' to 'Workflow SDK' (#1595) [world] Use zod/v4 in queue files to match @workflow/world schemas (#1588) [ai] Fix fatal stream errors surfacing as [object Object] (#1589) [web] Fix server crash on unmatched routes (#1590) docs: rename 'Complex Example' to 'Instance Methods as Steps' (#1592) Version Packages (beta) (#1563) [core] Extend flow route duration to "max" and fail runs where replay takes too long (#1567) fix: check target run capabilities before encrypting hook payloads (#1572) [core] Combine initial run fetch, event fetch, and run_started event creation (#1569) [docs] Split World API docs into sub-pages, update skill.md (#1457) [nitro] Preserve workflow step registration side effects (#1386) ... # Conflicts: # skills/workflow/SKILL.md
Summary
POSTexportworkflow/steps.mjsWhy
In Nitro/Nuxt local production builds, the generated
workflow/steps.mjsbundle can be treated as a pure export provider when the virtual handler only imports{ POST }. That allows the step bundle's top-levelregisterStepFunction(...)calls to disappear from the final Nitro server bundle, which leads to runtime failures likeStep \"...\" not foundwhen a queued step executes.Importing the generated bundle for side effects before consuming
POSTkeeps the registration code in the final server output.Validation
pnpm vitest run packages/nitro/src/index.test.tspnpm --filter @workflow/example-nuxt buildregisterStepFunction(...)calls for app steps after this change