File too large on Gitlab CI/CD

j0j0HOBBY

a year ago

Hi, i'm trying to add a CI/CD to my project but the deploy part always fail saying 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

0 Replies

j0j0HOBBY

a year ago

3f04c542-6a1b-4f34-9230-cf3922e8a905


a year ago

that's what? 350 megabytes?
the limit is 40 as far as I know.


j0j0HOBBY

a year ago

It's a nestjs api and nextjs api


j0j0HOBBY

a year ago

Nothing really exceptional here


a year ago

download a zip of the repo, how big is the zip?


j0j0HOBBY

a year ago

5,9 Mb


a year ago

then something you are doing is generating 345mb worth of data before uploading


a year ago

why do you have build stages in your action file?


j0j0HOBBY

a year ago

It's not a good practice to have three stages in the CI/CD, test => build => deploy ?


a year 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


j0j0HOBBY

a year ago

This is really true thank you so much haha


j0j0HOBBY

a year ago

I'll try like that


a year ago

sounds good


j0j0HOBBY

a year 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

But the problem stay the same : Failed to upload code. File too large (321410994 bytes)


a year ago

you don't have anything in lfs?


j0j0HOBBY

a year ago

I never used git lfs so far, my api is really not that big


a year ago

I mean railway isn't making up these numbers, the large upload data is coming from somewhere


j0j0HOBBY

a year 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


a year ago

I mean it shouldn't, but even so, the railway binary isn't going to be anywhere near 320mb


j0j0HOBBY

a year ago

Yeah but in that case how can we explain that it's working just fine from the terminal ?


j0j0HOBBY

a year ago

There must be a difference between the two of them, something is trying to be pushed that isn't when i do it manually ?


a year ago

I mean gitlab ci environment and your local environment are vastly different things


a year ago

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?


j0j0HOBBY

a year ago

It's a possibility, do you think it might resolve the problem ?


a year ago

well there would be no need for the action file as railway can deploy straight from a github repo


j0j0HOBBY

a year ago

I will try to do that, thanks for your help, still feels weird about this problem tho


a year ago

I agree, I am stumped


File too large on Gitlab CI/CD - Railway Help Station