Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Using env_logger crashes the worker #696

Open
1 task done
pmalek opened this issue Jan 18, 2025 · 0 comments
Open
1 task done

[BUG] Using env_logger crashes the worker #696

pmalek opened this issue Jan 18, 2025 · 0 comments

Comments

@pmalek
Copy link

pmalek commented Jan 18, 2025

Is there an existing issue for this?

  • I have searched the existing issues

What version of workers-rs are you using?

0.5.0

What version of wrangler are you using?

3.103.2

Describe the bug

Trying to use env_logger's but I cannot make it work.

env_logger::init() doesn't enable the work because RUST_LOG environment variable is not set ( I couldn't make it work, that's presumably because wasm doesn't have access to env?).

After that attempt I tried to use

env_logger::builder().filter_level(log::LevelFilter::Debug).init()

but that crashes the worker:

✘ [ERROR] service core:user:PROJECT: Uncaught RuntimeError: unreachable

    at [object Object] in $func1519
    at [object Object] in $func993
    at [object Object] in $func1069
    at [object Object] in $func1489
    at [object Object] in $func1272
    at [object Object] in $func1271
    at [object Object] in $func1253
    at [object Object] in $func259
    at [object Object] in $func158
    at [object Object] in $func204



✘ [ERROR] The Workers runtime failed to start. There is likely additional logging output above.

Steps To Reproduce

Use env_logger in worker code, e.g.:

#[event(start)]
fn start() {
    console_log!("Worker started successfully!");
    // env_logger::init(); // Doesn't work
    env_logger::builder().filter_level(log::LevelFilter::Debug).init(); // Crash
    info!("Worker started successfully!"); 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant