We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
serve
1.0.29+a146856d1
Darwin 23.3.0 arm64 arm
import { serve, Serve, Server, sleep } from 'bun'; declare global { // eslint-disable-next-line no-var var server: Server; } const parseBody = async (request: Request): Promise<unknown | null> => { if (request.body) { const body = await request.json(); return body; } else { return null; } }; const bootstrap = (): Server => { const options: Serve = { port: 4000, development: true, async fetch(request: Request): Promise<Response> { await sleep(200 + Math.random() * 100); const body = await parseBody(request); return new Response(JSON.stringify(body)); }, }; if (!global.server) { global.server = serve(options); } else { global.server.reload(options); } return global.server; }; bootstrap();
curl localhost:4000 -d '{"hello":"world"}'
It should not segfault.
It segfaults with Segmentation fault: 11
Segmentation fault: 11
It starts working when excluding the sleep call or the parseBody one
sleep
parseBody
The text was updated successfully, but these errors were encountered:
Fixes #9222
dc11322
Fixes #9222 (#9230)
30fdfdb
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Successfully merging a pull request may close this issue.
What version of Bun is running?
1.0.29+a146856d1
What platform is your computer?
Darwin 23.3.0 arm64 arm
What steps can reproduce the bug?
curl localhost:4000 -d '{"hello":"world"}'
What is the expected behavior?
It should not segfault.
What do you see instead?
It segfaults with
Segmentation fault: 11
Additional information
It starts working when excluding the
sleep
call or theparseBody
oneThe text was updated successfully, but these errors were encountered: