nitrojs / nitrojs/nitro

Plugin registered handlers are not bundled

Open
#3,707 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug v3
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Environment

Nitro version: 3.1.0-20251028-160624-0b002649
Bun: 1.3.1
Also tried:
Node version: v20.18.2

Reproduction

Build a minimal example from https://github.com/vercel/workflow

Describe the bug

While it is workinf in dev, the output from nitro build doesn't include the code related to handlers registered via a module like here: https://github.com/vercel/workflow/blob/577d2121b826db535343ab04cc64386d9ba5e087/packages/nitro/src/index.ts#L58

Which at the end, in this special case, produce a step not found error like:

(base) ➜  gigi git:(main) ✗ bun run .output/server/index.mjs
...
[embedded world] Failed to queue message {
  queueName: "__wkf_step_step//workflows/...,
  text: "\"Error: Step \\\"step//workflows/...\\\" not found\"",
  status: 500,
  headers: {
    "content-length": "105",
    "content-type": "application/json;charset=utf-8",
    date: "Thu, 30 Oct 2025 18:37:08 GMT",
  },
  ...
}
Additional context

No response

Logs
(base) ➜  gigi git:(main) ✗ bun run build
$ bunx --bun vite build
Discovering workflow directives 109ms
Created intermediate workflow bundle 24ms
Created steps bundle 12ms
Creating webhook route

◐ Building [Nitro] (preset: bun, compatibility: 2025-10-30)                                                                                                                                                                                               nitro 7:36:48 PM
✔ Generated public .output/public                                                                                                                                                                                                                        nitro 7:36:48 PM
vite v7.1.12 building SSR bundle for production...
✓ 506 modules transformed.
.output/server/chunks/routes/.......get.mjs                                        0.37 kB
.output/server/chunks/routes/......mjs                                             0.39 kB
.output/server/chunks/routes/support-request/......post.mjs   1.17 kB
.output/server/chunks/routes/support-request/......post.mjs                        1.19 kB
.output/server/index.mjs                                                          47.35 kB
✓ built in 2.51s
ℹ Generated .output/nitro.json                                                                                                                                                                                                                                 7:36:50 PM

✔ You can preview this build using bun run .output/server/index.mjs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the minimal example from the linked vercel/workflow repository, then compare development behavior with the production output from nitro build. Inspect the handler registration in packages/nitro/src/index.ts and the generated .output/server/index.mjs; done means registered handlers are present in the bundle and the step-not-found error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.