Getting a "prefix not found" error when running railway up

I'm trying to deploy a monorepo via railway CLI but only one of the repos is deployed on railway, so i'm using Docker to do so and using railway.json inside the repo folder for the configuration. When I run railway up --servicename --environment <PATH_TO_RAILWAY_JSON> I'm getting a prefix not found error.
Indexed Compressed [====================] 100% prefix not found
Indexed Compressed [====================] 100% prefix not found
Is there a way to know where the error is/how to fix it? Thanks!
Solution:
yeah that's not a path to a railway.json file either way, there is a far better way to set the path to your dockerfile, delete the railway.json and set this service variable - ``` RAILWAY_DOCKERFILE_PATH=/docker/prod/api/Dockerfile.api...
P
Percy14d ago
Project ID: 033f39f1-9797-405f-88f8-343ca4ac4254
J
Jay14d ago
033f39f1-9797-405f-88f8-343ca4ac4254
B
Brody14d ago
can you send your dockerfile and railway.json?
J
Jay14d ago
Hey @Brody , sorry for the late reply but here it is railway.json
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"dockerfilePath": "docker/prod/api/Dockerfile.api"
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"dockerfilePath": "docker/prod/api/Dockerfile.api"
}
}
Dockerfile
FROM node:20-alpine AS alpine
RUN apk add --no-cache libc6-compat
RUN apk update

# Setup pnpm and turbo on the alpine base
FROM alpine as base
RUN npm install pnpm turbo --global
RUN pnpm config set store-dir ~/.pnpm-store

# Prune projects
FROM base AS pruner

ARG PROJECT="@repo/api"

WORKDIR /app
COPY . .
RUN turbo prune --scope=${PROJECT} --docker

# Build the project
FROM base AS builder
ARG PROJECT="@repo/api"

WORKDIR /app

# Copy lockfile and package.json's of isolated subworkspace
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=pruner /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
COPY --from=pruner /app/out/json/ .

# First install the dependencies (as they change less often)
RUN pnpm install --frozen-lockfile

# Copy source code of isolated subworkspace
COPY --from=pruner /app/out/full/ .

# Env vars required to build the project
ARG DATABASE_URL
ARG RESEND_KEY
ARG BUILD_ENV

RUN turbo build:${BUILD_ENV} --filter=${PROJECT}
RUN rm -rf ./node_modules
RUN pnpm install --prod --frozen-lockfile

# Final image
FROM alpine AS runner

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nodejs
USER nodejs

WORKDIR /app
COPY --from=builder --chown=nodejs:nodejs /app .
WORKDIR /app/apps/api

ARG PORT=8080
ENV PORT=${PORT}

CMD ["node","dist/index.js"]
FROM node:20-alpine AS alpine
RUN apk add --no-cache libc6-compat
RUN apk update

# Setup pnpm and turbo on the alpine base
FROM alpine as base
RUN npm install pnpm turbo --global
RUN pnpm config set store-dir ~/.pnpm-store

# Prune projects
FROM base AS pruner

ARG PROJECT="@repo/api"

WORKDIR /app
COPY . .
RUN turbo prune --scope=${PROJECT} --docker

# Build the project
FROM base AS builder
ARG PROJECT="@repo/api"

WORKDIR /app

# Copy lockfile and package.json's of isolated subworkspace
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=pruner /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
COPY --from=pruner /app/out/json/ .

# First install the dependencies (as they change less often)
RUN pnpm install --frozen-lockfile

# Copy source code of isolated subworkspace
COPY --from=pruner /app/out/full/ .

# Env vars required to build the project
ARG DATABASE_URL
ARG RESEND_KEY
ARG BUILD_ENV

RUN turbo build:${BUILD_ENV} --filter=${PROJECT}
RUN rm -rf ./node_modules
RUN pnpm install --prod --frozen-lockfile

# Final image
FROM alpine AS runner

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nodejs
USER nodejs

WORKDIR /app
COPY --from=builder --chown=nodejs:nodejs /app .
WORKDIR /app/apps/api

ARG PORT=8080
ENV PORT=${PORT}

CMD ["node","dist/index.js"]
For some more context, this used to work when I only had a single service I wanted to deploy to railway and had the same config in root of the monorepo. But I want to add multiple services to railway with each having their own Dockerfile and thats where it is starting to break.
B
Brody14d ago
can you confirm that the dockerfile above is being used to run the build?
J
Jay14d ago
how can I do so? the railway up command's first output is the 'prefix not found' message and then it quits before getting to docker build. Is there another way besides it to check it?
B
Brody14d ago
J
Jay14d ago
Sorry but the issue is that the build isn't even getting started since I'm deploying via the CLI only and the service isn't associated with a Git repo.
B
Brody14d ago
I understand, but please open your build logs and if there are logs, download and send them
J
Jay14d ago
There aren't any build logs when I'm making these changes but here's the previous versions build logs if it helps
B
Brody14d ago
okay can I see a screenshot of the error in the cli? and just to be double clear, does a build even show up in the service when it fails from the cli?
J
Jay14d ago
Here's the screenshot with some info redacted. And no the build doesn't even show up in the service when it fails from the CLI.
No description
B
Brody14d ago
I understand redacting your terminal location, but the other stuff doesn't help, please send a new screenshot
J
Jay14d ago
would it be okay to share the service name and environment here? that's the only redacted thing besides the terminal location
B
Brody14d ago
unless you've named it something offensive, I don't see any issues
J
Jay14d ago
okay, just a sec
J
Jay14d ago
No description
B
Brody14d ago
specifying a path to the railway.json file isn't valid syntax as far as I know but you are only using it to set the path of the dockerfile right?
J
Jay14d ago
I found the usage of path from these docs here: https://docs.railway.app/reference/cli-api#up.
Railway Docs
CLI API Reference | Railway Docs
Documentation for Railway
J
Jay14d ago
Basically yeah the config just holds where the docker file is relative to the project
B
Brody14d ago
sorry where do those docs point out that you can set the path to the railway.json file?
J
Jay14d ago
No description
J
Jay14d ago
or is it path to the directory to be deployed? sorry if I might have misunderstood it.
Solution
B
Brody14d ago
yeah that's not a path to a railway.json file either way, there is a far better way to set the path to your dockerfile, delete the railway.json and set this service variable -
RAILWAY_DOCKERFILE_PATH=/docker/prod/api/Dockerfile.api
RAILWAY_DOCKERFILE_PATH=/docker/prod/api/Dockerfile.api
J
Jay14d ago
ah that's great! thanks @Brody.
Want results from more Discord servers?
Add your server
More Posts
Manually Deploy from Branch?There doesn't seem to be a clear way to manually deploy from a branch? I had a server that was auto Build Command Helpis it possible to make railway use dotnet 4.8 instead of 6.0?Read and write txt file in repositoryI have a github repository with a python script, Procfile, requirements.txt and points.txt but the pBuild PHP 7.3 with Laravel. How can i do it?I have an old application. How can i make build in service?TLS certificate has taken over 24 hours for a custom domainI have 2 custom domains - 1 using a subdomain and 1 using the root. The one on the subdomain is workRedis For Vector Search (GenAI)I have Redis database deployed on Railways Pro plan. I want to add LLM Retrieval Augmented GeneratioWhat is the best way to install private npm packages?My usecase is that my node app needs to install a package from a private github registry. What I wouCron job not running at specific timeHi I have a cron job that should run every hour 0 * * * *. For some reason, it skips runs sometimHow much is Railways scalable?Is there any information how much it is scalable in reality? According to the price, can the serviceCORS Policy problem with backboard.railway.app/graphqlI'm getting a CORS error in my console when using the Railway dashboard. ``` Access to fetch at 'hOutbound ip addressesHi, what are railway's outbound ip addressesBest way to setup back up system for my postgres?Looking to do a backup every X number of hoursRailway <> Hetzner servers cant communicateWe had a deployment running succesfully for the last week today, the railway instances cant communihow to remove docker cache ?it is always just using cache, and not rebuilding correclyDeployment HelpApologies i have 3 things to deploy and i dont know how to do itCannot Access Railway APIJust noticed that I am unable to access the full public API and the GraphQL Playground isn't workingHow do I create a config file?In the [documentation](<https://docs.railway.app/guides/config-as-code>) for Railway configuration fRedis Connection FailureProject ID: d09cd450-b0ba-483f-ae0c-5e329305f433 Redis is refusing connnections.504 Gateway Timeout issueAll of a sudden my production application starts throwing up 504 error. There are no error logs and Vite React ThreejsI copy nixpacks.toml and Caddyfile from this repository <https://github.com/brody192/vite-react-tem