Error Deploying SvelteKit on Railway: Actions expect form-encoded data (received application/json)
Hello Railway community!
I'm facing a challenge while attempting to deploy my SvelteKit application with Docker on Railway. Locally, the application works flawlessly, but when deploying it on Railway using Docker, I encounter the following error:
Error: Actions expect form-encoded data (received application/json)
at call_action (file:///app/build/server/index.js:1243:11)
at handle_action_json_request (file:///app/build/server/index.js:1112:24)
at render_page (file:///app/build/server/index.js:2635:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async resolve2 (file:///app/build/server/index.js:3699:24)
at async respond (file:///app/build/server/index.js:3585:22)
at async Array.ssr (file:///app/build/handler.js:1243:3)
Additional Details:
I am using pnpm as a package manager.
In my SvelteKit configuration, I have not set any specific FORM_METHOD in the adapter.
The application works locally with Docker Compose but encounters issues on Railway.
I am using the Node.js adapter.
Relevant Configuration:
Dockerfile, svelte.config.js, and vite.config.js.
How form requests are handled in my application.
I would greatly appreciate any guidance, suggestions, or shared experiences. Has anyone faced this issue before or has ideas on how to address it in the Railway environment?
Thank you in advance for your assistance! π
5 Replies
Project ID:
a8811665-c1ce-4652-aa45-763413e953d0
Solution
please make sure you are using https when calling the service
this is my project id:
a8811665-c1ce-4652-aa45-763413e953d0
i'm deploying a dockerized sveltekit app
I'm using form-actions for sveltekit
use https please
Thank you. It works.