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

Deno panic when using file:/// url with sass #26994

Open
ploiu opened this issue Nov 22, 2024 · 1 comment
Open

Deno panic when using file:/// url with sass #26994

ploiu opened this issue Nov 22, 2024 · 1 comment

Comments

@ploiu
Copy link

ploiu commented Nov 22, 2024

using a file:/// url with sass (e.g. from using import.meta.url) causes a panic.

panic log:

file:///home/ploiu/.cache/deno/npm/registry.npmjs.org/sass/1.81.0/sass.dart.js:1724769: Uncaught TypeError: Cannot read properties of undefined (reading 'length')

============================================================
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.1.1
Args: ["/home/ploiu/.deno/bin/deno", "run", "-A", "./build.js"]

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde_v8-0.230.0/de.rs:582:47:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::unwrap_failed
   4: serde_v8::de::from_v8
   5: deno_core::error::JsError::inner_from_v8_exception
   6: deno_core::error::exception_to_err_result
   7: deno_core::runtime::jsruntime::JsRuntime::poll_event_loop
   8: deno_core::runtime::jsruntime::JsRuntime::run_event_loop::{{closure}}
   9: deno_runtime::worker::MainWorker::run_event_loop::{{closure}}
  10: deno::worker::CliMainWorker::run::{{closure}}
  11: deno::tools::run::run_script::{{closure}}
  12: deno::spawn_subcommand::{{closure}}
  13: <deno_unsync::tokio::task::MaskFutureAsSend<F> as core::future::future::Future>::poll
  14: tokio::runtime::task::raw::poll
  15: deno::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

it throws an error using node as well (and when deno is using a package.json file oddly enough), but node/deno don't crash in that scenario.

reproducible example:

build.js

import * as sass from 'npm:sass'

const root = import.meta.url.replace('build.js', '')
const sassUrl = root + 'styles.scss'
// const sassUrl = './styles.scss' // this line works
sass.compile(sassUrl)

styles.scss

body {color: red;}

Please let me know if you need any more information!

@uncomfyhalomacro
Copy link
Contributor

Seems this line needs to be handled
https://github.com/denoland/deno_core/blob/8980c84728f61d452fcbc95ec9730dc857c1e220/serde_v8/de.rs#L582 rather than unwrapping.

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

2 participants