import.meta.url cannot use in Deno Deploy
hashrock opened this issue · comments
hashrock commented
I got this error in Deno Deploy.
GET /deno.png 2ms 500
Error serving request: TypeError: scheme 'file' not supported
at deno:core/01_core.js:106:46
at unwrapOpResult (deno:core/01_core.js:126:13)
at Object.opSync (deno:core/01_core.js:140:12)
at opFetch (deno:ext/fetch/26_fetch.js:57:17)
at mainFetch (deno:ext/fetch/26_fetch.js:199:61)
at deno:ext/fetch/26_fetch.js:439:11
at new Promise (<anonymous>)
at fetch (deno:ext/fetch/26_fetch.js:399:15)
at Object./deno.png (https://deno.land/x/sift@0.3.5/mod.ts:138:30)
at async handleRequest (https://deno.land/x/sift@0.3.5/mod.ts:63:36)
code:
serve({
"/deno.png": serveStatic("deno.png", { baseUrl: import.meta.url }),
"/": () => json({ message: "Hello world" })
});
https://github.com/hashrock-sandbox/study-deploy-sift/blob/master/main.ts#L4
It doesn't happen with deployctl, but it does when I deploy to deno deploy.
What should I specify for baseUrl instead?
Satya Rohith commented
Hi @hashrock 👋. Thanks for opening the issue. This is related to #35. fetch doesn't support file:
URLs, so I should use the now supported fs APIs: https://deno.com/deploy/docs/runtime-fs
Satya Rohith commented
Satya Rohith commented