let folder = "./"
let server = Bun.serve({
async fetch (req) {
let path = new URL(req.url).pathname;
console.log(path);
if (path === "/") path = "storage.html";
let file = Bun.file(`${folder}/${path}`);
if (await file.exists()) return new Response(file);
return new Response('404');
}
})
console.log(`Server running on ${server.url}`);
storage.html
<head>
<title>Project tracker</title> <link rel="stylesheet" href="./styles.css">
</head>
<h1>HI hi</h1>
<form><input type="text"><input type="button" value="enter" onclick="webWorkerTest()"></form>
<script>
function webWorkerTest() {
if(typeof(Worker) !== "undefined") {
let w = new Worker("workers/baseLog.js");
w.onmessage = function(event) {
console.log(event.data);
if(event.data === "finished") w.terminate()
};
} else {
console.log("Sorry, your browser does not support Web Workers...");
}
}
</script>
There was no file for workers/baseLog.js, and running it a second time makes it work. I don't know why it glitched.
Relevant log output
Bun v1.1.17 (bb66bba1) Windows x64
Args: "C:\Users\kaimc\.bun\bin\bun.exe" ".\server.js"
Features: jsc abort_signal http_server
Builtins: "bun:main"
Elapsed: 4708ms | User: 62ms | Sys: 109ms
RSS: 98.41MB | Peak: 98.73MB | Commit: 0.17GB | Faults: 24398
panic(main thread): Internal assertion failure
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:
Stack Trace (bun.report)
Bun v1.1.17 (bb66bba) on windows x86_64 [RunCommand]
How can we reproduce the crash?
server.js
storage.html
There was no file for workers/baseLog.js, and running it a second time makes it work. I don't know why it glitched.
Relevant log output
Stack Trace (bun.report)
Bun v1.1.17 (
bb66bba
) on windows x86_64 [RunCommand]panic: Internal assertion failure
debug.zig:443
:panicExtra
bun.zig:3252
:assertionFailure
blob.zig:1706
:sharedView
ReadFile.zig:756
:queueRead
??
fs__open
uv_run
uws.zig:2819
:tickWithoutIdle
JSC__JSValue__fastGet_
shimmer.zig:186
:cppFn