failed to solve: secret API not found
moissidi
HOBBYOP

5 days ago

Build Failed: build daemon returned an error < failed to solve: secret API not found >

Awaiting Conductor Response$10 Bounty

2 Replies

Railway
BOT

5 days ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway 5 days ago


shanu-web
HOBBY

5 days ago

This error means the build expects a secret named API but Railway isn't passing one. Railway exposes your service variables as build secrets, so the secret id must exactly match a variable name on the service.

Check these in order:

Dockerfile secret mount — if your Dockerfile has RUN --mount=type=secret,id=API ..., you must have a variable named exactly API (case-sensitive) in your service → Variables tab. Either add it, or rename the mount id to match your actual variable (e.g. API_KEY).

Railpack picking up a stray reference — if you're not using a Dockerfile, Railpack may have detected ${API} somewhere (config files, application properties, build scripts) and turned it into a required build secret. Check your build logs for the generated railpack-plan.json section (just before "load build definition") — if API is listed under secrets there, find and fix the reference or add the variable.

Variable added but not redeployed — variables added after the last deploy aren't picked up automatically at build time. After adding API, trigger a fresh deployment (Cmd/Ctrl+K → "Deploy Latest Commit").

If none of that matches, share your Dockerfile (or confirm you're on Railpack/Nixpacks) and the few lines above the error in the build logs.


shanu-web

This error means the build expects a secret named API but Railway isn't passing one. Railway exposes your service variables as build secrets, so the secret id must exactly match a variable name on the service. Check these in order: Dockerfile secret mount — if your Dockerfile has RUN --mount=type=secret,id=API ..., you must have a variable named exactly API (case-sensitive) in your service → Variables tab. Either add it, or rename the mount id to match your actual variable (e.g. API_KEY). Railpack picking up a stray reference — if you're not using a Dockerfile, Railpack may have detected ${API} somewhere (config files, application properties, build scripts) and turned it into a required build secret. Check your build logs for the generated railpack-plan.json section (just before "load build definition") — if API is listed under secrets there, find and fix the reference or add the variable. Variable added but not redeployed — variables added after the last deploy aren't picked up automatically at build time. After adding API, trigger a fresh deployment (Cmd/Ctrl+K → "Deploy Latest Commit"). If none of that matches, share your Dockerfile (or confirm you're on Railpack/Nixpacks) and the few lines above the error in the build logs.

moissidi
HOBBYOP

5 days ago

Awsome Shanu-web, thank you for your advice! Now I found where was mistake!


Welcome!

Sign in to your Railway account to join the conversation.

Loading...