Build error using Gitlab CI - RangeError: Maximum ...
# support
c
Is there anyone that might be able to provide some answers as to why I might be getting this error when building in Gitlab CI? Builds locally just fine.
Copy code
yarn build
yarn run v1.22.19
$ rimraf dist && tsc && vite build
error during build:
RangeError: Maximum call stack size exceeded
    at RegExp.exec (<anonymous>)
    at file:///builds/developers/marti-admin-v2/node_modules/vite/dist/node/chunks/dep-3b8eb186.js:37117:54
    at Array.reduce (<anonymous>)
    at _interpolate (file:///builds/developers/marti-admin-v2/node_modules/vite/dist/node/chunks/dep-3b8eb186.js:37116:18)
    at file:///builds/developers/marti-admin-v2/node_modules/vite/dist/node/chunks/dep-3b8eb186.js:37150:15
    at Array.reduce (<anonymous>)
    at _interpolate (file:///builds/developers/marti-admin-v2/node_modules/vite/dist/node/chunks/dep-3b8eb186.js:37116:18)
    at file:///builds/developers/marti-admin-v2/node_modules/vite/dist/node/chunks/dep-3b8eb186.js:37150:15
    at Array.reduce (<anonymous>)
    at _interpolate (file:///builds/developers/marti-admin-v2/node_modules/vite/dist/node/chunks/dep-3b8eb186.js:37116:18)
error Command failed with exit code 1.
r
hi @codey1416 ! I'm happy to help, though it's not immediately clear what the root cause might be
c
Thank you!
r
Which pacakge is being built when this fails?
This could be an issue with rollup? https://github.com/vitejs/vite/issues/12914
c
Copy code
"scripts": {
    "dev": "vite",
    "build": "rimraf dist && tsc && vite build",
    "lint:fix": "eslint ./src --ext .ts,.tsx --quiet --fix --ignore-path ./.gitignore",
    "lint:format": "prettier  --loglevel warn --write \"./**/*.{js,jsx,ts,tsx,css,md,json}\" ",
    "lint": "concurrently yarn:lint:*",
    "prettier": "prettier --write .",
    "test": "jest",
    "source-map-explorer": "source-map-explorer dist/**/*.js --gzip"
  },
So it is running the build command when it fails
r
for which package?
c
This is an almost vanilla implementation of the packages/app workspace - one file change and a few new images
r
šŸ‘
c
And again - it builds successfully locally
Copy code
ā–¶ yarn build
yarn run v1.22.19
$ rimraf dist && tsc && vite build
vite v4.4.7 building for production...
āœ“ 5366 modules transformed.
dist/index.html                   0.90 kB │ gzip:   0.46 kB
dist/assets/index-9b7f1ec0.css    0.08 kB │ gzip:   0.09 kB
dist/assets/index-de8aaa20.js   929.60 kB │ gzip: 263.47 kB

(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
āœ“ built in 10.49s
✨  Done in 18.16s.
@rahul1 So the only images in the project are replacement images for the 3 that come standard in the static folder
r
Is there any chance you could share your CI configuration for this build step? I'd like to see if there's some issue with te vite version
c
Copy code
variables:
  NC: '\033[0m'
  PURPLE: '\033[1;35m'
  BLUE: '\033[1;34m'
  GIT_DEPTH: 1
  MEDPLUM_BASE_URL: $MEDPLUM_BASE_URL
  MEDPLUM_CLIENT_ID: $MEDPLUM_CLIENT_ID
  GOOGLE_CLIENT_ID: $GOOGLE_CLIENT_ID
  RECAPTCHA_SITE_KEY: $RECAPTCHA_SITE_KEY
  MEDPLUM_REGISTER_ENABLED: $MEDPLUM_REGISTER_ENABLED

image: node:18.7.0

stages:
  - build
  - test
  - deploy
  - review
  - dast
  - staging
  - canary
  - production
  - incremental rollout 10%
  - incremental rollout 25%
  - incremental rollout 50%
  - incremental rollout 100%
  - performance
  - cleanup
build:
  stage: build
  script:
    - |
      # block
      echo -e "${PURPLE}--------------------------${NC}"
      echo -e "${PURPLE}Building...${NC}"
      echo -e "${PURPLE}--------------------------${NC}"
    - rm -rf node_modules
    - export NODE_OPTIONS="--max-old-space-size=8192"
    - yarn config set network-timeout 300000
    - yarn cache clean
    - yarn install
    - yarn build
    - |
      # block
      echo -e "${PURPLE}--------------------------${NC}"
      echo -e "${PURPLE}Building complete${NC}"
      echo -e "${PURPLE}--------------------------${NC}"
test:
  stage: test
  script:
    - |
      # block
      echo -e "${PURPLE}--------------------------${NC}"
      echo -e "${PURPLE}Testing...${NC}"
      echo -e "${PURPLE}--------------------------${NC}"
    - export NODE_OPTIONS="--max-old-space-size=4096"
    - yarn install
    - yarn test
    - |
      # block
      echo -e "${PURPLE}--------------------------${NC}"
      echo -e "${PURPLE}Testing complete${NC}"
      echo -e "${PURPLE}--------------------------${NC}"

sast:
  stage: test

include:
  - template: Jobs/SAST.gitlab-ci.yml
  - template: Security/Secret-Detection.gitlab-ci.yml
We are, of course, failing at the build stage
r
yep
c
Looks like it is something related to the
tsc
command. If I change the build script to simply
vite build
it works
r
hmm ok thank you
Any modifications to your tsconfig.json?
that might be because there is no code to build, b/c tsc did not run
By any chance, does you .env file have default values? This ticket seems to match your error message: https://github.com/vitejs/vite/issues/13399
c
I'll take a look
@rahul1 What needs to happen to get cron functionality to show for bots?
r
Hi @codey1416 - do you mind posting as a new thread? in #1094022380659155005
Was your CI issue resolved?
c
Yes CI issue resolved - thank you!
172 Views