a year 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
a year ago
YAY I LOVE SVELTE
a year ago
Since when can you run node server.js for svelte?
a year ago
I don't think that's a thing
a year ago
Node adapter?
It's a new thing I'm trying, I'm trying many things to get it to work back on railway
a year ago
Yeah that's not right either
then I tried the classic node buildbut it didn't work either, and then an express server
a year ago
Change it to the node adapter and I'll give you a dockerfile
a year ago
It's very simple
a year ago
Nope
a year 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"]a year ago
That's your Dockerfile
a year ago
Just throw it in and it will all magically work
a year ago
You've got it set to the node adapter?
a year 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;
a year ago
Euhhhhh
a year ago
You don't need all that
a year ago
Don't set the adapter out dir
a year ago
The rest is probably fine
a year ago
Just make sure you keep adapter() no parameters
a year ago
What's the dotenv thing
a year ago
Oh no no no
a year ago
Just the top part
a year ago
Only need this part

a year ago
Yeah only do the usage part
I pushed to railway the dockerfile and all, I comeback when it works (or when it crashes)
a year ago
Good good good good good good
Do you import your variables like this ?
import { R2_ACCESS_KEY, R2_ACCOUNT_ID, R2_SECRET_KEY, R2_BUCKET_NAME, R2_PUBLIC_URL } from "$env/static/private";
cause it's causing me to fail build
a year ago
Uhhhhhhhhhhhhhhhhhhhhhhhhhh
a year ago
Isn't it $app/environment
a year ago
mm noo
a year ago
Is that server side or client side
a year ago
Definitely server
a year ago
I just use process.env.VARIABLE_NAME
a year ago
Apparently yours should work the same
a year 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)
a year ago
Can you show the build error
a year ago
You removed this right

but also, why do I need a dockerfile now, does it has something to do with metal servers ?
a year ago
I always just use dockerfiles and it always works ¯_(ツ)_/¯
a year 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
a year 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.