File too large on Gitlab CI/CD

Hi, i'm trying to add a CI/CD to my project but the deploy part always fail saying
File too large.
File too large.
. But when i'm doing the same thing in my terminal it works just fine. Would you have an idea what i'm missing ?
image: node:latest

stages:
- build
- deploy

cache:
paths:
- node_modules/
- .pnpm-store

build_api:
stage: build
before_script:
- corepack enable
- corepack prepare pnpm@latest-8 --activate
- pnpm config set store-dir .pnpm-store
script:
- pnpm --filter api install --frozen-lockfile
- pnpm --filter api build
artifacts:
paths:
- packages/api/dist
only:
- main

build_intra:
stage: build
before_script:
- corepack enable
- corepack prepare pnpm@latest-8 --activate
- pnpm config set store-dir .pnpm-store
script:
- pnpm --filter intra install --frozen-lockfile
- pnpm --filter intra build
artifacts:
paths:
- packages/intra/.next
only:
- main

deploy_api:
stage: deploy
image: ubuntu
script:
- apt-get update && apt-get install -y curl
- curl -fsSL https://railway.app/install.sh | sh
- railway up --service=api -d
only:
- pushes
- main
environment:
name: production
url: https://your-api-url

deploy_intra:
stage: deploy
image: ubuntu
script:
- apt-get update && apt-get install -y curl
- curl -fsSL https://railway.app/install.sh | sh
- railway up --service=intra -d
only:
- pushes
- main
image: node:latest

stages:
- build
- deploy

cache:
paths:
- node_modules/
- .pnpm-store

build_api:
stage: build
before_script:
- corepack enable
- corepack prepare pnpm@latest-8 --activate
- pnpm config set store-dir .pnpm-store
script:
- pnpm --filter api install --frozen-lockfile
- pnpm --filter api build
artifacts:
paths:
- packages/api/dist
only:
- main

build_intra:
stage: build
before_script:
- corepack enable
- corepack prepare pnpm@latest-8 --activate
- pnpm config set store-dir .pnpm-store
script:
- pnpm --filter intra install --frozen-lockfile
- pnpm --filter intra build
artifacts:
paths:
- packages/intra/.next
only:
- main

deploy_api:
stage: deploy
image: ubuntu
script:
- apt-get update && apt-get install -y curl
- curl -fsSL https://railway.app/install.sh | sh
- railway up --service=api -d
only:
- pushes
- main
environment:
name: production
url: https://your-api-url

deploy_intra:
stage: deploy
image: ubuntu
script:
- apt-get update && apt-get install -y curl
- curl -fsSL https://railway.app/install.sh | sh
- railway up --service=intra -d
only:
- pushes
- main
No description
23 Replies
Percy
Percy3mo ago
Project ID: 3f04c542-6a1b-4f34-9230-cf3922e8a905
フ0フ0
フ0フ03mo ago
3f04c542-6a1b-4f34-9230-cf3922e8a905
Brody
Brody3mo ago
that's what? 350 megabytes? the limit is 40 as far as I know.
フ0フ0
フ0フ03mo ago
It's a nestjs api and nextjs api Nothing really exceptional here
Brody
Brody3mo ago
download a zip of the repo, how big is the zip?
フ0フ0
フ0フ03mo ago
5,9 Mb
Brody
Brody3mo ago
then something you are doing is generating 345mb worth of data before uploading why do you have build stages in your action file?
フ0フ0
フ0フ03mo ago
It's not a good practice to have three stages in the CI/CD, test => build => deploy ?
Brody
Brody3mo ago
why not let railway do the building? it's not like they charge for the builder, and it's not like they are going to push the deployment if the build fails
フ0フ0
フ0フ03mo ago
This is really true thank you so much haha I'll try like that
Brody
Brody3mo ago
sounds good
フ0フ0
フ0フ03mo ago
I greatly reduced my action file :
stages:
- deploy

cache:
paths:
- node_modules/
- .pnpm-store

deploy_api:
stage: deploy
image: ubuntu
script:
- apt-get update && apt-get install -y curl
- curl -fsSL https://railway.app/install.sh | sh
- railway up --service=api -d
only:
- pushes
- main
environment:
name: production
url: https://your-api-url

deploy_intra:
stage: deploy
image: ubuntu
script:
- apt-get update && apt-get install -y curl
- curl -fsSL https://railway.app/install.sh | sh
- railway up --service=intra -d
only:
- pushes
- main
stages:
- deploy

cache:
paths:
- node_modules/
- .pnpm-store

deploy_api:
stage: deploy
image: ubuntu
script:
- apt-get update && apt-get install -y curl
- curl -fsSL https://railway.app/install.sh | sh
- railway up --service=api -d
only:
- pushes
- main
environment:
name: production
url: https://your-api-url

deploy_intra:
stage: deploy
image: ubuntu
script:
- apt-get update && apt-get install -y curl
- curl -fsSL https://railway.app/install.sh | sh
- railway up --service=intra -d
only:
- pushes
- main
But the problem stay the same :
Failed to upload code. File too large (321410994 bytes)
Failed to upload code. File too large (321410994 bytes)
Brody
Brody3mo ago
you don't have anything in lfs?
フ0フ0
フ0フ03mo ago
I never used git lfs so far, my api is really not that big
Brody
Brody3mo ago
I mean railway isn't making up these numbers, the large upload data is coming from somewhere
フ0フ0
フ0フ03mo ago
zipped my api is 168 KB. Would it be possible that it is trying to push something with it ? Like railway itself that i just installed ? Idk i'm just trying to understand haha
Brody
Brody3mo ago
I mean it shouldn't, but even so, the railway binary isn't going to be anywhere near 320mb
フ0フ0
フ0フ03mo ago
Yeah but in that case how can we explain that it's working just fine from the terminal ? There must be a difference between the two of them, something is trying to be pushed that isn't when i do it manually ?
Brody
Brody3mo ago
I mean gitlab ci environment and your local environment are vastly different things forgive me for asking as I know this is not a real solution, but simply moving your code over to github is not an option right?
フ0フ0
フ0フ03mo ago
It's a possibility, do you think it might resolve the problem ?
Brody
Brody3mo ago
well there would be no need for the action file as railway can deploy straight from a github repo
フ0フ0
フ0フ03mo ago
I will try to do that, thanks for your help, still feels weird about this problem tho
Brody
Brody3mo ago
I agree, I am stumped