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 with --allow-net=URL #25760

Closed
Skalman opened this issue Sep 20, 2024 · 1 comment · Fixed by #25770
Closed

Panic with --allow-net=URL #25760

Skalman opened this issue Sep 20, 2024 · 1 comment · Fixed by #25770
Labels
2.0 feedback bug Something isn't working correctly
Milestone

Comments

@Skalman
Copy link

Skalman commented Sep 20, 2024

Version: Deno 2.0.0-rc.4

When specifying a URL (e.g. https://example.com) in the --allow-net argument, the CLi panics.

My assumption was that it'd be possible to specify a full URL, but I'm just greeted by a panic. It'd be good if you instead showed a readable error message. (Of course, it'd be even nicer if it were supported.)

$ RUST_BACKTRACE=1 deno --allow-net=https://example.com

============================================================
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: linux x86_64
Version: 2.0.0-rc.4
Args: ["deno", "--allow-net=https://example.com"]

thread 'main' panicked at cli/args/flags.rs:5084:60:
called `Result::unwrap()` on an `Err` value: ErrorInner { kind: InvalidValue, context: FlatMap { keys: [], values: [] }, message: Some(Raw("invalid port in 'https://example.com': '//example.com'\n\nStack backtrace:\n   0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from\n   1: deno_core::error::uri_error\n   2: deno_permissions::NetDescriptor::parse\n   3: deno::args::flags_net::parse\n   4: deno::args::flags::runtime_args_parse\n   5: deno::args::flags::run_parse\n   6: deno::args::flags::flags_from_vec\n   7: <deno_unsync::tokio::task::MaskFutureAsSend<F> as core::future::future::Future>::poll\n   8: tokio::runtime::task::raw::poll\n   9: deno::main\n  10: std::sys_common::backtrace::__rust_begin_short_backtrace\n  11: std::rt::lang_start::{{closure}}\n  12: std::rt::lang_start_internal\n  13: main\n  14: __libc_start_main\n             at /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:308:16\n  15: _start")), source: None, help_flag: None, styles: Styles { header: Style { fg: None, bg: None, underline: None, effects: Effects() }, error: Style { fg: None, bg: None, underline: None, effects: Effects() }, usage: Style { fg: None, bg: None, underline: None, effects: Effects() }, literal: Style { fg: None, bg: None, underline: None, effects: Effects() }, placeholder: Style { fg: None, bg: None, underline: None, effects: Effects() }, valid: Style { fg: None, bg: None, underline: None, effects: Effects() }, invalid: Style { fg: None, bg: None, underline: None, effects: Effects() } }, color_when: Never, color_help_when: Never, backtrace: None }
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: deno::args::flags::runtime_args_parse
   4: deno::args::flags::run_parse
   5: deno::args::flags::flags_from_vec
   6: <deno_unsync::tokio::task::MaskFutureAsSend<F> as core::future::future::Future>::poll
   7: tokio::runtime::task::raw::poll
   8: deno::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@marvinhagemeister marvinhagemeister added bug Something isn't working correctly 2.0 feedback labels Sep 20, 2024
@marvinhagemeister marvinhagemeister added this to the 2.0.0 milestone Sep 20, 2024
@littledivy
Copy link
Member

Yeah there needs to be a better error message for this. It works without url protocol:

target/debug/deno repl --allow-net=example.com
Deno 2.0.0-rc.4
exit using ctrl+d, ctrl+c, or close()
>

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

Successfully merging a pull request may close this issue.

3 participants