3 hours ago
Hello, I've switched from using Github to Gitlab but I have some issues getting the deployment working, I've tried these options:
deploy:
stage: deploy
image: ghcr.io/railwayapp/cli:latest
variables:
SVC_ID: "service-id"
script:
- railway up --environment=staging --service=$SVC_ID
script:
- RAILWAY_TOKEN=$RAILWAY_TOKEN railway up --environment=staging --service=$SVC_ID
script:
- export RAILWAY_TOKEN=$RAILWAY_TOKEN
- RAILWAY_TOKEN=$RAILWAY_TOKEN railway up --environment=staging --service=$SVC_IDbut I'm always getting this error:
Invalid RAILWAY_TOKEN. Please check that it is valid and has access to the resource you're trying to use.
am I doing something wrong? never had issues in github
10 Replies
3 hours ago
is this a user token or workspace token?
3 hours ago
Try RAILWAY_API_TOKEN.
if I set the api token then I get:
No linked project found. Run railway link to connect to a project
→ Run railway link to connect to a project.
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
2 hours ago
Try doing --environment staging. (Taken from CLI example: railway up --service api --environment production)
an hour ago
whats the error message? still invalid token
I've tried locally, doing RAILWAY_TOKEN=xxx railway up --environment staging --service xxx and it is now throwing Unauthorized. Please login with railway login
in the ci I'm getting:
Invalid RAILWAY_TOKEN. Please check that it is valid and has access to the resource you're trying to use.
And I've just tried with a fresh new token
I might have found the issue, for some reason passing the environment break the up command...I've removed the environment and it seems to work fine 🤔
one issue I've noticed, but it is related to gitlab not railway (I think), if the variable is masked and hidden it doesn't work 🤷♂️