gornostay25 / svelte-adapter-bun

A SvelteKit adapter for Bun
MIT License
534 stars 33 forks source link

Body is empty when using +server.ts #43

Closed alex-pirogov closed 9 months ago

alex-pirogov commented 11 months ago

Hey!

I have the following handler in my project:

import { json, type RequestHandler } from '@sveltejs/kit'

export const POST: RequestHandler = async ({ request }) => {
    return json({ data: await request.json() })
}

The app is served with docker and proxied with nginx. When testing this endpoint with curl i receive following response, which means i cant read the body of my request.

curl  -X POST \
  'https://lk.qastud.io/tasks/field_validation' \
  --header 'Content-Type: application/json' \
  --data-raw '{"hello": "world"}'
{"data":""}

I've confirmed the body is transferred correctly to my server by adding body's content to nginx response headers. And also i've tried to deploy my app using node adapter and it works perfectly fine.

ambergristle commented 11 months ago

i ran into the same issue (on deployment, not locally), running bun:1.0-slim. switching to the node adapter worked for me too

@gornostay25 i'm down to help investigate this, and to contribute to the svelte-adapter-bun project more generally

zakius commented 10 months ago

for me it seems POST breaks when using hooks to modify locals, can't access body or form data, it just hangs there using the node adapter works fine

additionally dev build breaks when modifying the hooks file, it fails to find hooks.ts~ (sic) and requires you to restart the dev server

KaKi87 commented 9 months ago

Hello,

POST breaks [...] can't access body or form data, it just hangs there

I'm experiencing the same issue, even without hooks.

Any news on this @gornostay25 ?

Thanks