Sam W
Deployment with Project API Key
Hi there!
I'm running to an issue where it seems that you can't create a new deployment using a project team api token (RAILWAY_API_TOKEN when using the cli program, not RAILWAY_TOKEN). The url is "https://backboard.{hostname}/project/{}/environment/{}/up?serviceId={}" (copied from the cli program code), and I get a 401 when trying to perform the operation. In the docs about the public api it doesn't say anywhere that the team api token can't be used to create new deployments, but my experience suggests that you either need a project token or to login manually in the cli.
My use case is as follows: we deploy from the cli in a github actions workflow as it gives us a finer grained control over the deployment process, as opposed to using the automated deployments from a repository. When a branch is pushed, if there is a environment with the same name as the branch in railway, we'd like to deploy the code in that branch to the corresponding environment. Seems simple enough. But, since a project token is linked to a specific environment, you can't deploy to the target environment (in fact, it just silently deploys to the environment the token is linked to, even if you try specify another environment - very dangerous behaviour!). Managing a token per environment seems like a lot of work, so we'd much prefer it if the team api token just worked for deployments.
Any help/clarification from anyone would be much appreciated!
Cheers
17 replies