Reproduce dynamic import failure from redirected fallback module - #6963
Reproduce dynamic import failure from redirected fallback module#6963edmundhung wants to merge 1 commit into
Conversation
|
Good - I've confirmed the fallback service correctly handles both the static import path (where The reproduction is well-constructed and correctly demonstrates the bug. Let me think about whether there are any actionable issues:
I don't see any actionable issues in this PR. The reproduction is clean, minimal, well-documented, and correctly demonstrates the bug described. LGTM |
Merging this PR will improve performance by 10.22%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | bm_Promise_Fib10 |
20.1 µs | 18.3 µs | +10.22% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing edmundhung/module-fallback-redirect-repro (d568e22) with main (d900d79)
Footnotes
-
129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
Fix here: #6965 |
This adds a standalone reproduction for a V2 module fallback issue involving redirects and dynamic imports. It intentionally contains no runtime fix and does not depend on Vite or Workers SDK.
The Worker imports two bare dependencies that the fallback service redirects to canonical
file:///project/node_modules/...URLs:static-test-dependencystatically imports./value.mjsand succeeds.dynamic-test-dependencycallsimport("./value.mjs")fromload()and fails.With
workerd@1.20260810.1, the request logsstatic import: loaded, then returns HTTP 500 with:The fallback service never receives a request for the dynamic dependency's child module. This appears to happen because the dynamic import uses the redirected canonical URL as its referrer, while that canonical URL is not present in the isolate's module registry. Static imports from the same kind of redirected module use the original pre-redirect alias as their referrer and succeed.
The related Workers Vitest integration currently needs an isolated import-rewriting workaround for this behavior: cloudflare/workers-sdk#15117
To reproduce:
node samples/module-fallback-redirect/fallback.mjs.npx workerd@1.20260810.1 serve samples/module-fallback-redirect/config.capnp --experimental.curl http://127.0.0.1:8080.