Description
When using the new_module_registry compatibility flag with a module fallback service, the V2 protocol request is missing the rawSpecifier and attributes fields.
Expected Behavior
Per the V2 fallback service protocol schema, the JSON body should include:
{
"type": "import",
"specifier": "file:///bundle/missing-module.js",
"rawSpecifier": "./missing-module.js",
"referrer": "file:///bundle/worker.js",
"attributes": []
}
Actual Behavior
The rawSpecifier and attributes fields are never sent:
{
"type": "import",
"specifier": "file:///bundle/missing-module.js",
"referrer": "file:///bundle/worker.js"
}
Root Cause
In src/workerd/jsg/modules-new.c++, resolveWithCaching() creates a new ResolveContext but does not copy the rawSpecifier or attributes fields from the original context.
Reproduction
https://github.com/jamesopstad/v2-fallback-service-protocol-repro
Description
When using the
new_module_registrycompatibility flag with a module fallback service, the V2 protocol request is missing therawSpecifierandattributesfields.Expected Behavior
Per the V2 fallback service protocol schema, the JSON body should include:
{ "type": "import", "specifier": "file:///bundle/missing-module.js", "rawSpecifier": "./missing-module.js", "referrer": "file:///bundle/worker.js", "attributes": [] }Actual Behavior
The rawSpecifier and attributes fields are never sent:
{ "type": "import", "specifier": "file:///bundle/missing-module.js", "referrer": "file:///bundle/worker.js" }Root Cause
In
src/workerd/jsg/modules-new.c++,resolveWithCaching()creates a newResolveContextbut does not copy therawSpecifierorattributesfields from the original context.Reproduction
https://github.com/jamesopstad/v2-fallback-service-protocol-repro