What could cause a deploy not to run "yarn run build" ?
apollovl
PROOP

a month ago

Weird debugging this morning, we pushed to production commented code (nothing more), after the deploy, we realized that the production was using the .env variables from the developpement .env. Of course we panicked, search to the code, double and triple checked our api keys to make sure they where the correct ones.

Turns out the problem was that the Railway Build phase didn't run, when redeploying, everything worked.

Could someone explain this issue ?

$20 Bounty

3 Replies

Railway only skips the building phase if the source code hasn't changed from the previous build (If you have this option enabled).

If you have a .env file in your github repo; Railway will automatically detect and suggest environment variables from .env files. So most likely that's not related to the build incident.

Attachments


If the option to skip builds is turned off for you, perhaps if you could provide more information about the failed build, it would be easier to find the real cause.


ilyass012
FREE

a month ago

hey, looks like railway's "skipped builds" feature was triggered. when railway detects the same source code was already built before, it skips the build entirely and reuses the old cached image, including any env variables that were baked in at build time from a previous environment. that's why you were seeing dev env variables in production

the reason redeploying fixed it is because redeploying from the deployments tab always forces a full rebuild, bypassing the cache

to fix this permanently, go to your service settings and check if "skipped builds" is enabled under feature flags, if it is, disable it, or switch to injecting your env variables at runtime instead of baking them in at build time

source: docs.railway.com/builds/skipped-builds


Welcome!

Sign in to your Railway account to join the conversation.

Loading...