-
Couldn't load subscription status.
- Fork 27
Open
Description
My code: const { sql } = new SQLocal('test.sqlite')
Error: Failed to execute 'fetch' on 'WorkerGlobalScope': Failed to parse URL from /_next/static/media/sqlite3.bd4582ce.wasm
The problem is not with headers - i checked. It is with the fact that web workers cannot read from relative urls. Not sure why others don't see this issue.
I have isolated the problem (no react/nextjs needed). Running fetch in main thread is not a problem i get 200:
fetch('/_next/static/media/sqlite3.bd4582ce.wasm')
.then(res => console.log('WORKED:', res.status))
.catch(err => console.error('FAILED:', err));
Running the same in worker fails:
const workerScript = `
console.log('Worker location:', self.location.href);
fetch('/_next/static/media/sqlite3.bd4582ce.wasm')
.then(res => console.log('WORKED:', res.status))
.catch(err => console.error('FAILED:', err));
`;
const workerUrl = URL.createObjectURL(new Blob([workerScript]));
const myWorker = new Worker(workerUrl);
I get:
5c1d93e1-443e-43d3-822b-30a113fde221:7 FAILED: TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': Failed to parse URL from /_next/static/media/sqlite3.bd4582ce.wasm
If fetch is provided full URL in the web worker code, then it works.
Metadata
Metadata
Assignees
Labels
No labels