Sveltekit does not get the platform variable when processing api request
Hello I have a Cloudflare Pages App using Sveltekit and I want to integrate R2.
I have configured my wrangler.toml
I setup my src/app.d.ts:
I'm running the server through this command:
npx wrangler pages dev --proxy 5174 -- npm run dev -- --port 5174
And this is my endpoint
But event.platform is always undefined, no matter how I start the server, even when I deploy a preview build I do not have platform set.
Does anyone have an idea how to fix this, your help would be greatly appreciated.4 Replies
There is a PR to SvelteKit to support
platform
, but right now it only works if you build it then run wrangler pages dev
so after building start it with
wrangler pages dev ./svelte-kit/cloudflare
?Yes. Then it should have the bindings available
Thank you for the quick response 🙂