Skip to content

jamesopstad/v2-fallback-service-protocol-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

V2 Fallback Service Protocol Bug Reproduction

Demonstrates a bug in workerd's V2 fallback service protocol where rawSpecifier and attributes fields are never sent.

Bug Summary

When using new_module_registry, the fallback service should receive:

  • type: How the module was imported ("import", "require", "internal")
  • specifier: Normalized URL of the module
  • rawSpecifier: Original specifier as written in source code
  • referrer: Normalized URL of the importing module
  • attributes: Import attributes (e.g. { type: "json" })

Actual behavior: Only type, specifier, and referrer are sent.

Root Cause

In src/workerd/jsg/modules-new.c++:807-818, resolveWithCaching() creates a new ResolveContext but does not copy rawSpecifier or attributes.

Running

pnpm install

# Terminal 1
pnpm start

# Terminal 2
pnpm workerd

# Terminal 3
curl http://localhost:8080/

Expected vs Actual

Expected (per schema):

{
  "type": "import",
  "specifier": "file:///bundle/missing-module.js",
  "rawSpecifier": "./missing-module.js",
  "referrer": "file:///bundle/worker.js",
  "attributes": []
}

Actual (bug):

{
  "type": "import",
  "specifier": "file:///bundle/missing-module.js",
  "referrer": "file:///bundle/worker.js"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors