CI failes at serverless package step with:uploading artifacts - Error status=500 Internal Server Error

Hi,

I’m seeing errors when Gitlab tries to build and deploy to AWS serverless. Nothing has changed in the environments from what I can see since the last run.

CI/CD fails on the build stage. I’m using GitLab.com

Here is the gitlab-ci.yml file:

image: amaysim/serverless:2.13.0
before_script:
    - uname -a
    - node --version
    - yarn --version
    - serverless --version
    - aws --version
    - echo Stage is $STAGE

# Cache modules in between jobs
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - .yarn-cache

variables:
  AWS_SHARED_CREDENTIALS_FILE: "xxxx"
  AWS_CONFIG_FILE: "xxxx"
  YARN_CACHE_FOLDER: "xxxx"

.build:server_template: &build_server_job_definition
  stage: build
  script:
    - cd server
    - yarn install
    - serverless package --stage $STAGE

  artifacts:
    paths:
      - server/.serverless


build:client:
  stage: build
  script:
    - cd client
    - yarn install
    - yarn run build

.deploy_template: &deploy_job_definition
  stage: deploy 
  script:
    - cd vpc # repeated deploys of the VPC won't change existing VPCs
    - yarn install
    - serverless deploy --stage $STAGE
    - cd ../server
    - yarn install
    - serverless deploy --package .serverless --stage $STAGE
    - cd ../client
    - yarn install
    - yarn run build
    - serverless client deploy --stage $STAGE --no-confirm

  artifacts:
    paths:
      - client/.env
      - server/.serverless


build:server:dev:
  variables:
    STAGE: dev
  <<: *build_server_job_definition

build:server:test:
  variables:
    STAGE: test
  <<: *build_server_job_definition

build:server:prod:
  variables:
    STAGE: prod
  <<: *build_server_job_definition

deploy:dev:
  variables:
    STAGE: dev
  dependencies:
    - build:server:dev
  <<: *deploy_job_definition

deploy:test:
  variables:
    STAGE: test
  dependencies:
    - build:server:test
  <<: *deploy_job_definition
  only:
    - develop

deploy:prod:
  variables:
    STAGE: prod
  dependencies:
    - build:server:prod
  <<: *deploy_job_definition
  when: manual
  only:
    - master

test:client:
  image: cypress/base:12
  stage: test
  before_script:
    - node --version
    - yarn --version
  script:
    - cd client
    - yarn install
    - yarn run start-then-test

And this is the error:

$ serverless package --stage $STAGE
Serverless: Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
            Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
            More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Creating cache remove-artifacts...
.yarn-cache: found 65963 matching files            
Uploading cache.zip to https://xxxxxxx.s3-eu-west-1.amazonaws.com/runner_cache/project/216/remove-artifacts 
Created cache
Uploading artifacts...
server/.serverless: found 27 matching files        
WARNING: Uploading artifacts to coordinator... failed  id=168878 responseStatus=500 Internal Server Error status=500 Internal Server Error token=txzLdqCc
WARNING: Retrying...                                error=invalid argument
WARNING: Uploading artifacts to coordinator... failed  id=168878 responseStatus=500 Internal Server Error status=500 Internal Server Error token=txzLdqCc
WARNING: Retrying...                                error=invalid argument
WARNING: Uploading artifacts to coordinator... failed  id=168878 responseStatus=500 Internal Server Error status=500 Internal Server Error token=txzLdqCc
FATAL: invalid argument                            
ERROR: Job failed: exit code 1

I’ve tried (per a colleagues recommendation) to comment out the artifacts section of the .yml file, but then I see an error that serverless-state.json cannot be found.

Any help or direction on how to troubleshoot is appreciated.

Thanks