`tanstack-start-trigger-wrapper.ts` static import of `dev-triggers.ts` crashes entire app when queue/cron handlers have `createRequire` dependencies
@TheAlexLichter đang làm issue này rồi.
Từ ngày 9/6/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Encountered a weird interaction when using Mastra with crons and queues. Once again, I've asked Claude to help dig into this in hopes that it'll help.
Appreciate it!
Environment
void: 0.9.2vite-plus: 0.1.24@cloudflare/vite-plugin: 1.39.2- Framework: TanStack Start (Class A)
- Compatibility date:
2026-02-24
What happens
Void generates .void/tanstack-start-trigger-wrapper.ts for Class A frameworks. In dev mode this wrapper contains a static top-level import:
import { handleDevTrigger } from './dev-triggers.ts';
.void/dev-triggers.ts (also auto-generated) statically imports every queue and cron handler:
import __job0 from "/path/to/crons/briefing-tick.ts";
import __queue0 from "/path/to/queues/briefing-generation.ts";
If any queue or cron handler transitively imports a package that uses createRequire from Node's module API — in this case @mastra/core, which does so in its gateway/LSP chunks — the TanStack Start worker runner throws on every single request:
require is not defined
at runInRunnerObject (workers/runner-worker/index.js:107:3)
at Object.fetch (.void/tanstack-start-trigger-wrapper.ts:7:34)
at maybeCaptureError (workers/runner-worker/index.js:51:10)
The app is completely broken — not just the dev trigger curls, every page load returns 500.
Why
The static import forces dev-triggers.ts (and therefore all queue/cron handlers and their full dependency trees) to be evaluated at worker module initialization time, before any request is handled. In TanStack Start's workerd-based runner, createRequire from node:module exists but the function it returns throws require is not defined when invoked against CJS modules. Try-catch blocks inside @mastra/core don't help because the import itself (module evaluation) is what fails.
Expected behavior
handleDevTrigger is only needed for POST /__void/scheduled and POST /__void/queue — requests that are only issued during local dev testing. The import should not cause every other request to break.
Minimal repro
- TanStack Start project with
void≥ 0.9.x - A queue handler in
queues/that imports@mastra/core(or any package usingcreateRequirefromnode:module) - Run
pnpm devand load any page — 500 on every request
Suggested fix
Convert the static import to a lazy dynamic import, only evaluated when a dev trigger path is detected:
// In the generated tanstack-start-trigger-wrapper.ts fetch handler:
async fetch(request, env, ctx) {
const url = new URL(request.url);
if (request.method === "POST" &&
(url.pathname === "/__void/scheduled" || url.pathname === "/__void/queue")) {
const { handleDevTrigger } = await import('./dev-triggers.ts');
const res = await handleDevTrigger(request, env, ctx);
if (res) return res;
}
return serveWithAssets(request, env, await original.fetch(request, env, ctx));
},
This ensures queue/cron handlers are only loaded when actually needed, isolating their dependency trees from the critical request path.
Workaround (in use)
Created a Vite plugin to patch the generated wrapper at dev-server startup to omit the dev-triggers.ts import entirely. Dev triggers are handled via TanStack routes instead.
- Ngôn ngữ chính
- TypeScript
- Star
- 149
- Fork
- 2
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của void-sdk/void
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Incorrect bindings Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
Tất cả issue của void-sdk/void
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
TanStack/tanstack.com#1293 ·