workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

How do I get full callstacks in the runtime log?

Open zelbrimo opened this issue 4 months ago • 1 comments

I didn't find this in your FAQ or docs, so I'm asking here.

I've been trying to get full callstacks from errors/panics in the console runtime log when I invoke wrangler with wrangler dev --local. In my wrangler.toml, I tried adding 'upload_source_maps=true' and to change my build command to call worker-build with --dev instead of release:

command = "cargo install -q worker-build && worker-build --release"

[env.development]
[env.development.build]
command = "cargo install -q worker-build && worker-build --dev"

In my cargo.toml, I added debug=2 and panic='unwind'

In my lib.rs, I have

pub fn main() {
    console_error_panic_hook::set_once();
    console_log::init_with_level(log::Level::Debug).expect("error initializing log");
}

I manually added a call to panic!() to see what happens, and I still get the minified js Error with nothing under the "Stack" section. Is there something else I can do to get rust callstacks for errors?

zelbrimo avatar Aug 25 '25 18:08 zelbrimo

In the latest 0.6.2 release we have improved panic handling considerably, by adding a default panic hook that logs the full error to the console with a stack.

Perhaps try that out and share your thoughts further.

There is also a coredump feature, which you can read more about here - https://github.com/cloudflare/wasm-coredump/tree/main/example.

guybedford avatar Sep 17 '25 00:09 guybedford