"Error: Project Token Not Found When Deploying with Railway CLI in GitHub Actions"

killianfraTRIAL

4 months ago

I'm encountering an issue while attempting to deploy my project to Railway using GitHub Actions. When I run the deployment step, I receive the following error message:
Project Token not found Error: Process completed with exit code 1.

Here's a simplified version of my GitHub Actions workflow:

name: Build and Deploy

on:

push:

branches:

- master

jobs:

build_and_deploy:

runs-on: ubuntu-latest

steps:

- name: Checkout code

uses: actions/checkout@v3

- name: Set up Node.js

uses: actions/setup-node@v3

with:

node-version: 20

- name: Install dependencies

run: npm install

- name: Build project

run: npm run build

- name: Set up Railway CLI

run: npm install -g @railway/cli

- name: Deploy to Railway

env:

RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}

run: railway up --service=${{ secrets.SVC_ID }}

The Secrets are all setup, but maybe i'm not getting them from the right spot ?

Solved

3 Replies

4 months ago

You need to create a Project Token in Railway, and then create a secret in your GitHub repo named RAILWAY_TOKEN and set the value to your Railway project token.

See the GitHub Docs for how to add a secret to a secret for a repository.


Status changed to Awaiting User Response railway[bot] 4 months ago


thomasaedkHOBBY

5 days ago

I have the same issue.

I have an API token in Railway (https://railway.com/account/tokens).

And I have a GitHub secret in my repository; RAILWAY_TOKEN with the correct API token value.

Using the GitHub workflow from https://blog.railway.com/p/github-actions, it fails with this error:

"Project Token not found".

Likewise, then I run this locally, I also get "Project Token not found":

RAILWAY_TOKEN=xx railway up --service=xx

I can make it work locally with the CLI by running run railway login and railway login first .

But as these interactive commands cannot be used in the workflow, how does one make this work?

Hope you can help with this.

Thanks


Status changed to Awaiting Railway Response railway[bot] 5 days ago


thomasaedkHOBBY

5 days ago

Disregard my comment:

I was confusing my API token for a Project token.

Sorry.


Status changed to Solved brody 5 days ago