-
-
Notifications
You must be signed in to change notification settings - Fork 34.9k
Open
Labels
source mapsIssues and PRs related to source map support.Issues and PRs related to source map support.
Description
Version
v24.14.0 | v25.7.0
Platform
Linux dev-0.edge.dev.cylerian.com 6.14.0-1018-aws #18~24.04.1-Ubuntu SMP Mon Nov 24 19:32:52 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
Subsystem
node:internal/source_map/source_map_cache
What steps will reproduce the bug?
Basic reproduction case:
export const run = () => {
console.log("hello world");
throw new Error('Unexpected Failure');
};
//# sourceMappingURL=test.mjs.mapTake this content and base64 encode it. Then use it within a client script (tmp.mjs) as a dataUri import:
const {run} = await import('data:text/javascript;base64,ZXhwb3J0IGNvbnN0IHJ1biA9ICgpID0+IHsKICBjb25zb2xlLmxvZygiaGVsbG8gd29ybGQiKTsKICB0aHJvdyBuZXcgRXJyb3IoJ1VuZXhwZWN0ZWQgRmFpbHVyZScpOwp9OwoKLy8jIHNvdXJjZU1hcHBpbmdVUkw9dGVzdC5tanMubWFw');
run();node --enable-source-maps tmp.mjs
node:internal/url:819
href = bindingUrl.parse(input, base, true);
^
TypeError: Invalid URL
at new URL (node:internal/url:819:25)
at dataFromUrl (node:internal/source_map/source_map_cache:250:18)
at maybeCacheSourceMap (node:internal/source_map/source_map_cache:179:16)
at compileSourceTextModule (node:internal/modules/esm/utils:331:5)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:111:18)
at #translate (node:internal/modules/esm/loader:473:20)
at afterLoad (node:internal/modules/esm/loader:529:29)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:534:12)
at #getOrCreateModuleJobAfterResolve (node:internal/modules/esm/loader:577:36)
at afterResolve (node:internal/modules/esm/loader:625:52) {
code: 'ERR_INVALID_URL',
input: 'test.mjs.map',
base: 'data:text/javascript;base64,ZXhwb3J0IGNvbnN0IHJ1biA9ICgpID0+IHsKICBjb25zb2xlLmxvZygiaGVsbG8gd29ybGQiKTsKICB0aHJvdyBuZXcgRXJyb3IoJ1VuZXhwZWN0ZWQgRmFpbHVyZScpOwp9OwoKLy8jIHNvdXJjZU1hcHBpbmdVUkw9dGVzdC5tanMubWFw'
}How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
Invalid sourcemap urls in comments should never cause execution script execution failure. Also, flat references are generated by many/most tools. However, it will happen even if you use a relative file path, etc.
The above occurs regardless of sourcemap existence.
What do you see instead?
Consistent exceptions thrown in the basic example above.
Additional information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
source mapsIssues and PRs related to source map support.Issues and PRs related to source map support.