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

Panic upon invalid import involving an import map #43

Open
hen-x opened this issue Jul 27, 2022 · 1 comment
Open

Panic upon invalid import involving an import map #43

hen-x opened this issue Jul 27, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@hen-x
Copy link

hen-x commented Jul 27, 2022

Under Deno 1.23.3 and 1.24.0, it is possible to produce a panic when running deno check given a particular invalid import configuration.

See a minimal repro here.

Panic trace:

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos aarch64
Version: 1.24.0
Args: ["/Users/henx/.deno/bin/deno", "check", "repro.ts"]

thread 'main' panicked at 'assertion failed: resolution_result.to_string().ends_with(\'/\')', /Users/ib/.cargo/registry/src/github.com-1ecc6299db9ec823/import_map-0.12.1/src/lib.rs:942:5
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: import_map::resolve_imports_match
   4: import_map::ImportMap::resolve
   5: <deno::resolver::ImportMapResolver as deno_graph::source::Resolver>::resolve
   6: deno_graph::graph::resolve
   7: deno_graph::graph::parse_module_from_ast
   8: deno_graph::graph::parse_module
   9: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  10: deno::proc_state::ProcState::prepare_module_load::{{closure}}
  11: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  13: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  14: deno::main::{{closure}}
  15: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  16: deno_runtime::tokio_util::run_local
  17: deno::main
@kitsonk kitsonk transferred this issue from denoland/deno Jul 27, 2022
@kitsonk kitsonk added the bug Something isn't working label Jul 27, 2022
@kitsonk
Copy link
Contributor

kitsonk commented Jul 27, 2022

We should either return a diagnostic earlier or error or return an empty value instead of panicking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants