Railway IaC Staging environment doesnt work with github actions
alexobrads
HOBBYOP

2 hours ago

Have found an issue with IaC when deploying to environments other than the initial environment set up.

Setup: We manage one project with Railway IaC (.railway/railway.ts, railway npm package) and two environments, production and staging. In GitHub Actions we use railwayapp/config@v1 as in the IaC docs: PRs into main plan against staging, and merging applies that plan. PRs into production do the same for production. Each environment has its own project token as a repo secret.

Problem: the production token works. The staging plan always fails with:

Unauthorized. Please check that your RAILWAY_TOKEN is valid and has access to the resource you're trying to use.

What we’ve checked:

The staging project token is valid: query { projectToken { projectId environmentId } } returns the staging project and environment.

railway status with that token works and lists every staging service.

Locally, railway config plan, with or without --environment staging and with the directory unlinked, fails the same way. RAILWAY_VERBOSE=1 adds no detail.

Several freshly created staging project tokens all behave the same.

Same result with CLI 5.71 (in the action) and the latest CLI via npx @railway/cli@latest.

When can we expect a fix? we should be able to use IaC for different environments

$20 Bounty

0 Replies

Status changed to Awaiting Railway Response Railway • about 2 hours ago


Railway
BOT

2 hours ago

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

Status changed to Open Railway • about 2 hours ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...