You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wrangler dev --local cannot start the worker: index.ts exports non-handler constants #1324
bunx wrangler dev -c wrangler-sccn.toml --env dev --local fails before serving a single request:
✘ [ERROR] service core:user:nemar-api-dev: Uncaught TypeError: Incorrect type for map entry 'NON_PROD_SANDBOX_CLEANUP_QUERY': the provided value is not of type 'function or ExportedHandler'.
✘ [ERROR] The Workers runtime failed to start.
Reproduced on 2026-09-08 with wrangler 4.85.0 and 4.130.0, on the unmodified dev entry point. The deployed worker is unaffected because production only reads the default export, but the local runtime treats every named export of the entry module as a potential entrypoint and rejects a string.
Cause
backend/src/index.ts exports NON_PROD_SANDBOX_CLEANUP_QUERY, PROD_SANDBOX_CLEANUP_QUERY, and DEV_CRON_ALLOWLIST so that backend/test/cron-dev-safety.test.ts and backend/test/exemplar-wiring.test.ts can import the production SQL rather than retype it.
Fix
Move the three constants to a new module (for example backend/src/services/cron-safety.ts), import them into index.ts, and point the two tests at the new module.
Leave index.ts with only export default { fetch, scheduled }.
Add a pure test that reads backend/src/index.ts as text and asserts it has exactly one export statement, so the regression cannot come back silently (the same source-text pattern exemplar-wiring.test.ts already uses).
Found while writing the MCP phase 2 smoke script (#1294, PR #1323); that script sidesteps the problem with its own minimal entry module until this lands.
Activity
mcp: unblock the workerd smoke with a minimal entry, not index.ts (#1323
Phase 2: MCP host fork and discovery tools (#1323)
fix: correct ADR 0050's platform claim and the docs target
Phase 5: ADR 0050 and a Python MCP client verification (#1330)