denoflare icon indicating copy to clipboard operation
denoflare copied to clipboard

No stacktrace sources in `denoflare serve`

Open nounder opened this issue 1 year ago • 2 comments

When running a script via denoflare serve, error stracktraces don't have source file path:

Error servicing request Error: DenoflareResponse.statusText not implemented
    at DenoflareResponse.get statusText (blob:null/479bbc34-2f8a-4e03-9c0c-6e2cb57f332e:479:15)
    at WorkerRouter.#fireError (blob:null/2f968119-42b1-4463-a069-f31f715a2813:774:78)
    at WorkerRouter.#route (blob:null/2f968119-42b1-4463-a069-f31f715a2813:768:28)
    at Object.fetch (blob:null/2f968119-42b1-4463-a069-f31f715a2813:958:27)
    at ModuleWorkerExecution.fetch (blob:null/479bbc34-2f8a-4e03-9c0c-6e2cb57f332e:629:34)
    at WorkerExecution.fetch (blob:null/479bbc34-2f8a-4e03-9c0c-6e2cb57f332e:727:34)
    at blob:null/479bbc34-2f8a-4e03-9c0c-6e2cb57f332e:3107:41
    at RpcChannel.receiveMessage (blob:null/479bbc34-2f8a-4e03-9c0c-6e2cb57f332e:39:42)
    at self.onmessage (blob:null/479bbc34-2f8a-4e03-9c0c-6e2cb57f332e:3146:30)
    at wrappedHandler (ext:deno_web/02_event.js:1401:12)

nounder avatar Feb 18 '24 15:02 nounder

Yes this is tricky. Denoflare bundles (and rebundles) your code and runs it in a permissionless worker by defaule, and the last time I looked into it (a while ago) it was impossible to send sourcemaps. Might be a good idea to look into it again and see if it's still the case.

You can run with --local-isolation none which will import your code directly, but you'll lose auto-reloading, and will run outside of the permissionless worker so will be able to access the fs etc (ie an environment less like cloudflare). https://denoflare.dev/cli/serve

johnspurlock-skymethod avatar Feb 18 '24 15:02 johnspurlock-skymethod

last time I looked into it (a while ago) it was impossible to send sourcemap

Couldn't find code that is responsible for bundling but after https://github.com/denoland/deno/issues/11073 and general development of Fresh framework, esbuild is working really smooth with Deno. High confidence that source map should work with it.

You can run with --local-isolation none which will import your code directly, but you'll lose auto-reloading, and will run outside of the permissionless worker so will be able to access the fs etc (ie an environment less like cloudflare).

Ah, I haven't considered that. I moved my side project to wrangler now because I wanted to make it happen ™, but will try it out in my next revision.

nounder avatar Feb 19 '24 02:02 nounder