svelte-adapter-bun icon indicating copy to clipboard operation
svelte-adapter-bun copied to clipboard

can not upload file to api route

Open applemate opened this issue 1 year ago • 7 comments

with node-adapter I can upload file to api route

with svelte-adapter-bun I can not upload file to api route. Error: 403 forbidden

tested with the same file and size

to reproduce

create a brand new sveltekit app from command line

create an api route with POST request create a +page.svelte in a normal route in src , in there you upload file to api route using fetch with post method. it will fail.

applemate avatar May 20 '24 06:05 applemate

Can you provide a repository with a minimal demo app? @craigcosmo

ptrxyz avatar Jun 16 '24 23:06 ptrxyz

here is the repo

https://github.com/craigcosmo/mytron

applemate avatar Jun 20 '24 16:06 applemate

@craigcosmo In your reproduction, in file /src/lib/config.ts, doesn't look like you updated the dev urls:

let apiUrl: string =
  env == 'production'
  ? 'https://contron.vn/api/'
  : 'http://localhost:2233/api/'

Changing the dev url to 'http://localhost:9955/api/' gave me a success message.

KyleFontenot avatar Jul 15 '24 21:07 KyleFontenot

I mean it works on localhost, but not on any server, whether it's vercel or render.com

When I switched back to node apdater, the upload worked on servers.

applemate avatar Jul 30 '24 16:07 applemate

@craigcosmo, the origin checking has been changed lately, could you test if it still fails?

notramo avatar Oct 02 '24 17:10 notramo

This happened before the origin checking

applemate avatar Oct 03 '24 02:10 applemate

My hypothesis is that origin-checking is not the issue, but more that there were problems with how Bun handled requests. In Bun 1.1.27 they seemed to have fixed it, so after upgrading Bun, I'd be curious if the problem remains.

KyleFontenot avatar Oct 03 '24 22:10 KyleFontenot