8 months ago
I'm using sveltekit on railway, it worked fine for more than a year.
Now on this very morning, railway made a new deploy using metal server.
Now it's dead, I made some changes but it still is dead.
It works very well on local.
> node server.js
✅ Server running on http://0.0.0.0:8080I'm using express server to deploy, the PORT is well detected and selected by railway but I get "error 404"
59 Replies
8 months ago
YAY I LOVE SVELTE
8 months ago
Since when can you run node server.js for svelte?
8 months ago
I don't think that's a thing
8 months ago
Node adapter?
It's a new thing I'm trying, I'm trying many things to get it to work back on railway
8 months ago
Yeah that's not right either
then I tried the classic node buildbut it didn't work either, and then an express server
8 months ago
Change it to the node adapter and I'll give you a dockerfile
8 months ago
It's very simple
8 months ago
Nope
8 months ago
FROM node:23-alpine AS build
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM node:23-alpine
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
COPY --from=build /app /app
RUN CI=1 pnpm install --prod --frozen-lockfile
EXPOSE 3000
CMD ["node", "build"]8 months ago
That's your Dockerfile
8 months ago
Just throw it in and it will all magically work
8 months ago
You've got it set to the node adapter?
8 months ago
Can you just screenshot the file please I'm confused
import adapter from "@sveltejs/adapter-node";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: [".svelte"],
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
env: {
dir: "./",
},
csrf: {
checkOrigin: false,
},
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter({
out:'build',
}),
},
};
export default config;8 months ago
Euhhhhh
8 months ago
You don't need all that
8 months ago
Don't set the adapter out dir
8 months ago
The rest is probably fine
8 months ago
Just make sure you keep adapter() no parameters
8 months ago
What's the dotenv thing
8 months ago
Oh no no no
8 months ago
Just the top part
8 months ago
Only need this part

8 months ago
Yeah only do the usage part
I pushed to railway the dockerfile and all, I comeback when it works (or when it crashes)
8 months ago
Good good good good good good
Do you import your variables like this ?
import { R2ACCESSKEY, R2ACCOUNTID, R2SECRETKEY, R2BUCKETNAME, R2PUBLICURL } from "$env/static/private";
cause it's causing me to fail build
8 months ago
Uhhhhhhhhhhhhhhhhhhhhhhhhhh
8 months ago
Isn't it $app/environment
8 months ago
mm noo
8 months ago
Is that server side or client side
8 months ago
Definitely server
8 months ago
I just use process.env.VARIABLE_NAME
8 months ago
Apparently yours should work the same
8 months ago
Oh. You have to do it like this
import { env } from '$env/dynamic/private';
console.log(env.DEPLOYMENT_SPECIFIC_VARIABLE);I'v always used that https://svelte.dev/tutorial/kit/env-static-private x)
8 months ago
Can you show the build error
8 months ago
You removed this right

but also, why do I need a dockerfile now, does it has something to do with metal servers ?
8 months ago
I always just use dockerfiles and it always works ¯_(ツ)_/¯
8 months ago
Did this end up working?
Well it did not for me, the alpine did not have the good component and I tried to find a better one but still getting issues. Then I tried back like it was at the beginning the day after, and it worked back x) but thank you very much for your help, I will consider more using docker for my next project, it seems very simple for deployment
8 months ago
Hello Railway Team,
I’m using the Hobby plan and have successfully connected www.arvipoa.org and arvipoa.org via DNS, but I’m getting a 404 error.
Could you please help confirm if these domains are properly mapped to my deployed application entry point? Also, is there any limit that could be causing this issue despite being on the Hobby plan?
Thank you for your support.