fix: preserve Nitro workflow step registration side effects#1386
fix: preserve Nitro workflow step registration side effects#1386VaguelySerious merged 4 commits intovercel:mainfrom
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 |
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