Metal Error 404
lmgerard
HOBBYOP

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:8080

I'm using express server to deploy, the PORT is well detected and selected by railway but I get "error 404"

$10 Bounty

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?


lmgerard
HOBBYOP

a year ago

It's a new thing I'm trying, I'm trying many things to get it to work back on railway


lmgerard
HOBBYOP

a year ago

previously I was just using vite preview --host which is bad I guess


a year ago

Yeah that's not right either


lmgerard
HOBBYOP

a year ago

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


lmgerard
HOBBYOP

a year ago

changing to node adapter is just doing node build no ?


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


lmgerard
HOBBYOP

a year ago

everything setup except for nodenv, I'm doing this


lmgerard
HOBBYOP

a year ago

dotenv*


a year ago

You've got it set to the node adapter?


lmgerard
HOBBYOP

a year ago

already got it,


lmgerard
HOBBYOP

a year ago

but was not using it I guess


a year ago

Can you just screenshot the file please I'm confused


lmgerard
HOBBYOP

a year ago

but it was in script x)


lmgerard
HOBBYOP

a year ago

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;

lmgerard
HOBBYOP

a year ago

my svelte 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


lmgerard
HOBBYOP

a year ago

I have to do the dotenv thing ? seems to work without it (in local)


a year ago

What's the dotenv thing


lmgerard
HOBBYOP

a year ago

for the environnement variables


a year ago

Oh no no no


a year ago

Just the top part


a year ago

Only need this part

1382728385209438208


lmgerard
HOBBYOP

a year ago

it says it works bad on production


lmgerard
HOBBYOP

a year ago

ok ok


a year ago

Yeah only do the usage part


lmgerard
HOBBYOP

a year ago

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


lmgerard
HOBBYOP

a year ago

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);

lmgerard
HOBBYOP

a year ago


a year ago

Can you show the build error


a year ago

You removed this right

1382733392545845389


lmgerard
HOBBYOP

a year ago

deployment is taking forever


lmgerard
HOBBYOP

a year ago

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?


lmgerard
HOBBYOP

a year ago

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


bilnet1
HOBBY

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.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...