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

Implicit dependency on deno_net extension from within deno_fetch extension #27297

Open
Houndie opened this issue Dec 9, 2024 · 2 comments
Open

Comments

@Houndie
Copy link

Houndie commented Dec 9, 2024

I will preface this by stating that I don't know much about deno and I'm learning as I'm going, so this is entirely possibly user error.

I'm attempting to initialize a deno_core::JsRuntime with the deno_fetch extension. According to the documentation and the dependency list deno_net is not a dependency of deno_fetch (in fact, it appears it's the other way around!). However attempting to use only deno_fetch results in this error at runtime:

thread '<unnamed>' panicked at /Users/houndie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_core-0.324.0/runtime/jsruntime.rs:745:9:
Failed to initialize a JsRuntime: Specifier "ext:deno_net/02_tls.js" was not passed as an extension module and was not included in the snapshot.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I browsing the source I find this suspect import potentially causing this?

Would love advice on how I can fix this on my side. I tried including deno_net and dependencies, which does seem to solve the problem, but it seems there's also a dependency on telemetry which requires typescript transpilation to use that extension so I thought I'd take a pause before following that rabbit hole.

@Houndie
Copy link
Author

Houndie commented Dec 9, 2024

My code for reference:

    let mut runtime = deno_core::JsRuntime::new(RuntimeOptions {
        module_loader: Some(Rc::new(module_loader)),
        extensions: vec![
            my_extension::init_ops(),
            deno_console::init_ops_and_esm(),
            deno_webidl::init_ops_and_esm(),
            deno_url::init_ops_and_esm(),
            deno_web::init_ops_and_esm::<PermissionsContainer>(
                Arc::new(BlobStore::default()),
                None,
            ),
            deno_fetch::init_ops_and_esm::<PermissionsContainer>(Default::default()),
        ],
        ..Default::default()
    });

@Houndie
Copy link
Author

Houndie commented Dec 9, 2024

I will note that it appears that adding deno_net to your extensions solves the problem. Instead of solving the subsequent telemetry problem, it appeared to be a recent change so I rolled back a few versions.

It does seem like there's a silent dependency issue here that requires fixing though.

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