Railway up fails to upload in Github Action

I'm trying to deploy via Github Actions so my railway server deploys after db migrations are complete. Here's what the railway part of the action looks like,
deploy_railway:
runs-on: ubuntu-latest
needs: [db_migration]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node 12
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn

- name: Install Railway
run: npm i -g @railway/cli

- name: Deploy
run: railway up --service api-server --verbose
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_RELEASE_TOKEN }}
deploy_railway:
runs-on: ubuntu-latest
needs: [db_migration]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node 12
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn

- name: Install Railway
run: npm i -g @railway/cli

- name: Deploy
run: railway up --service api-server --verbose
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_RELEASE_TOKEN }}
Running this results in the error:
railway up
service: 9aad5d57-3685-492a-914a-df035b2faf7a
environment: 155bd4b0-26bd-451c-94db-54216985dd41
bytes: 260789612
url: https://backboard.railway.app/project/f87f4adf-2d4b-45bb-b71e-4ea8351c53be/environment/155bd4b0-26bd-451c-94db-54216985dd41/up?serviceId=9aad5d57-3685-492a-914a-df035b2faf7a
Uploading...
Failed to upload code with status code 520 <unknown status code>
railway up
service: 9aad5d57-3685-492a-914a-df035b2faf7a
environment: 155bd4b0-26bd-451c-94db-54216985dd41
bytes: 260789612
url: https://backboard.railway.app/project/f87f4adf-2d4b-45bb-b71e-4ea8351c53be/environment/155bd4b0-26bd-451c-94db-54216985dd41/up?serviceId=9aad5d57-3685-492a-914a-df035b2faf7a
Uploading...
Failed to upload code with status code 520 <unknown status code>
Doing the same locally shows a more specific error message: Failed to upload code. File too large (260810846 bytes). I saw from previous threads that the railway up file limit is 40mb. Is there anyway to log what's being zipped and uploaded to railway? How does this work when it's connected via GitHub on Railway but breaks through the CLI?
Solution:
you could use a .railwayignore file to ignore files / folders from being tarballed?
Jump to solution
12 Replies
Percy
Percy2w ago
Project ID: 9aad5d57-3685-492a-914a-df035b2faf7a,155bd4b0-26bd-451c-94db-54216985dd41,f87f4adf-2d4b-45bb-b71e-4ea8351c53be,155bd4b0-26bd-451c-94db-54216985dd41,9aad5d57-3685-492a-914a-df035b2faf7a
Brody
Brody7d ago
yes you can use the verbose flag, that should print the tarball size and yes 40MB is the maximum size
david0
david0OP7d ago
Is there anyway to see and control what's actually being uploaded? verbose flag only shows the total file size, doesn't show what it's uploading. This is in a monorepo so I'm guessing that's why it's exceeding file limits, but not everything in the monorepo is needed for this service.
Brody
Brody7d ago
it's uploading everything minus the files not allowed by your .gitignore isolated or shared mono repo?
david0
david0OP7d ago
shared
Brody
Brody7d ago
may I ask why not deploy straight from GitHub instead of using railway up?
david0
david0OP7d ago
we have a github action to manage deploys, this includes db migrations and deploying other services. If we don't wait for CI, then the railway service can be deployed before the db migrations are finished. If we wait for CI, it then has to wait for the whole action to be finished which includes the building for other services, so the railway service gets deployed like 5 mins later than it should. Trying to place it in the action so we can deploy right after the migrations are done, to minimize the time there's discrepancy between the deployed code / db migration.
Brody
Brody7d ago
fair
Solution
Brody
Brody7d ago
you could use a .railwayignore file to ignore files / folders from being tarballed?
Brody
Brody7d ago
same syntax as .gitignore
david0
david0OP7d ago
oh didn't know that was a thing, thanks i'll try that nice that worked perfectly, thanks for the help!
Brody
Brody7d ago
No problem!
Want results from more Discord servers?
Add your server