deno icon indicating copy to clipboard operation
deno copied to clipboard

Deno has panicked `thread 'main' panicked at 'Provided URL was not file:// URL:`

Open grempe opened this issue 3 years ago • 2 comments

I was trying to debug an issue with a package I pushed as a third party lib to deno.land.

// Currently broken due to import issues. https://deno.land/x/[email protected]

The code I was calling was:

import { Tree, encodeHex, sha512_256 } from "https://deno.land/x/[email protected]/mod.ts";

const ARRAY_LENGTH = 1_000
const rawData: number[] = Array.from(Array(ARRAY_LENGTH)).map(() => Math.floor(Math.random()))
const data: Uint8Array[] = rawData.map((x) => { return sha512_256(new Uint8Array([x])) })
console.log('data.length\n', data.length)

const t = new Tree(data, 'sha512_256')

const r = t.root()
console.log('root\n', encodeHex(r))

const d = data[Math.floor(Math.random() * data.length)]

const p = t.proofObject(d)
console.log('proof\n', p)

console.log('verified?\n', Tree.verify(r, p, d, 'sha512_256')) // true or false

The backtrace output is:

✖1 ❯ RUST_BACKTRACE=1 deno run --compat --unstable --allow-env examples/deno/index.ts

============================================================
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 x86_64
Version: 1.21.1
Args: ["deno", "run", "--compat", "--unstable", "--allow-env", "examples/deno/index.ts"]

thread 'main' panicked at 'Provided URL was not file:// URL: https://deno.land/x/[email protected]/src/modules/package.json', cli/compat/esm_resolver.rs:154:25
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: deno::compat::esm_resolver::to_file_path
   3: deno::compat::esm_resolver::get_package_scope_config
   4: deno::compat::esm_resolver::package_resolve
   5: <deno::compat::esm_resolver::NodeEsmResolver 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: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  15: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  16: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  17: deno::run_command::{{closure}}
  18: deno::main::{{closure}}
  19: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  20: deno_runtime::tokio_util::run_basic
  21: deno::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

grempe avatar May 18 '22 20:05 grempe

This appears to be caused by the server returning an HTTP error response code when trying to retrieve one of the files. I am seeing this behavior with a couple of different packages when trying to load from ESM or SkyPack.

justin0mcateer avatar May 25 '22 00:05 justin0mcateer

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 25 '22 05:07 stale[bot]