-
-
Notifications
You must be signed in to change notification settings - Fork 46
Closed as not planned
Description
Describe the bug
It logs this error:
Error: JsError(JsError { name: Some("TypeError"), message: Some("Cannot read properties of undefined (reading 'os')"), stack: Some("TypeError: Cannot read properties of undefined (reading 'os')\n at formatHostName (file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/ext:deno_http/00_serve.ts:681:16)\n at onListen (file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/ext:deno_http/00_serve.ts:788:20)\n at serveHttpOnListener (file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/ext:deno_http/00_serve.ts:809:3)\n at Object.serve (file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/ext:deno_http/00_serve.ts:795:10)\n at file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/serve.ts:1:12"), cause: None, exception_message: "Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'os')", frames: [JsStackFrame { type_name: None, function_name: Some("formatHostName"), method_name: None, file_name: Some("file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/ext:deno_http/00_serve.ts"), line_number: Some(681), column_number: Some(16), eval_origin: None, is_top_level: Some(true), is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: None }, JsStackFrame { type_name: None, function_name: Some("onListen"), method_name: None, file_name: Some("file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/ext:deno_http/00_serve.ts"), line_number: Some(788), column_number: Some(20), eval_origin: None, is_top_level: Some(true), is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: None }, JsStackFrame { type_name: None, function_name: Some("serveHttpOnListener"), method_name: None, file_name: Some("file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/ext:deno_http/00_serve.ts"), line_number: Some(809), column_number: Some(3), eval_origin: None, is_top_level: Some(true), is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: None }, JsStackFrame { type_name: Some("Object"), function_name: Some("serve"), method_name: Some("serve"), file_name: Some("file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/ext:deno_http/00_serve.ts"), line_number: Some(795), column_number: Some(10), eval_origin: None, is_top_level: Some(false), is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: None }, JsStackFrame { type_name: None, function_name: None, method_name: None, file_name: Some("file:///Users/yuhr/.ghr/github.com/yuhr/rustyscript/serve.ts"), line_number: Some(1), column_number: Some(12), eval_origin: None, is_top_level: Some(true), is_eval: false, is_native: false, is_constructor: false, is_async: false, is_promise_all: false, promise_index: None }], source_line: None, source_line_frame_index: Some(0), aggregated: None })
To Reproduce
- Create
examples/serve.rs
with following content:
use rustyscript::{worker::DefaultWorker, Error, Module};
fn main() -> Result<(), Error> {
let worker = DefaultWorker::new(Default::default())?;
let module = Module::new(
"serve.ts",
"await Deno.serve((request) => new Response(\"hello\", { status: 200 })).finished",
);
worker.load_module(module)?;
Ok(())
}
- Run
RUST_BACKTRACE=1 cargo run --example serve --features='all_extensions'
Expected behavior
The server starts and respond at 127.0.0.1:8000
, as it's the default configuration of hostname and port, documented in the documentation comment of Deno.serve
.
Desktop (please complete the following information):
- OS: macOS Sequoia 15.0
- Browser: N/A
- Version: master
Additional context
Note that #353 is required to runcompile the example successfully.
Metadata
Metadata
Assignees
Labels
No labels