Maximum call stack size error

I keep getting RangeError: Maximum call stack size exceeded when building my site 1508insuranceaipoc.
I have checked for recursion, and my codebase shouldnt have any. Im building through this repo: https://github.com/TWoolff/insurancaai. Im new to using netlify functions though, can anyone help me out?

This is the buildlog:

5:50:31 AM: build-image version: 73f16e520fdddf409be6f578c8c2c8941bdf32d3 (focal)
5:50:31 AM: buildbot version: a11acbb405af91d225b392f15bc00822dbffb366
5:50:31 AM: Fetching cached dependencies
5:50:31 AM: Starting to download cache of 545.0MB
5:50:41 AM: Finished downloading cache in 9.604s
5:50:41 AM: Starting to extract cache
5:50:44 AM: Finished extracting cache in 3.557s
5:50:44 AM: Finished fetching cache in 13.248s
5:50:44 AM: Starting to prepare the repo for build
5:50:44 AM: Preparing Git Reference refs/heads/main
5:50:46 AM: Starting to install dependencies
5:50:46 AM: Python version set to 3.8
5:50:46 AM: Attempting Ruby version 2.7.2, read from environment
5:50:47 AM: Using Ruby version 2.7.2
5:50:47 AM: Started restoring cached go cache
5:50:47 AM: Finished restoring cached go cache
5:50:48 AM: go version go1.19.12 linux/amd64
5:50:48 AM: Using PHP version 8.0
5:50:49 AM: Started restoring cached Node.js version
5:50:49 AM: Finished restoring cached Node.js version
5:50:50 AM: v18.17.1 is already installed.
5:50:50 AM: Now using node v18.17.1 (npm v9.6.7)
5:50:50 AM: Enabling Node.js Corepack
5:50:50 AM: Started restoring cached build plugins
5:50:50 AM: Finished restoring cached build plugins
5:50:50 AM: Started restoring cached corepack dependencies
5:50:50 AM: Finished restoring cached corepack dependencies
5:50:50 AM: Started restoring cached yarn cache
5:50:54 AM: Finished restoring cached yarn cache
5:50:54 AM: No yarn workspaces detected
5:50:54 AM: Started restoring cached node modules
5:50:54 AM: Finished restoring cached node modules
5:50:54 AM: Installing npm packages using Yarn version 1.22.19
5:50:55 AM: yarn install v1.22.19
5:50:55 AM: [1/4] Resolving packages…
5:51:03 AM: warning netlify-cli > copy-template-dir > readdirp > micromatch > snapdragon > source-map-resolve@0.5.3: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
5:51:04 AM: warning netlify-cli > copy-template-dir > readdirp > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments.
5:51:04 AM: warning netlify-cli > copy-template-dir > readdirp > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
5:51:04 AM: warning netlify-cli > copy-template-dir > readdirp > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
5:51:05 AM: [2/4] Fetching packages…
5:51:06 AM: [3/4] Linking dependencies…
5:51:06 AM: warning netlify-cli > @netlify/build > ts-node@10.9.1 has unmet peer dependency @types/node@*.
5:51:08 AM: [4/4] Building fresh packages…
5:51:12 AM: success Saved lockfile.
5:51:12 AM: Done in 16.83s.
5:51:12 AM: npm packages installed using Yarn
5:51:12 AM: Install dependencies script success
5:51:12 AM: Starting build script
5:51:13 AM: Detected 1 framework(s)
5:51:13 AM: vite at version 4.4.9
5:51:13 AM: Section completed: initializing
5:51:14 AM: ​
5:51:14 AM: Netlify Build
5:51:14 AM: ────────────────────────────────────────────────────────────────
5:51:14 AM: ​
5:51:14 AM: ❯ Version
5:51:14 AM: @netlify/build 29.20.12
5:51:14 AM: ​
5:51:14 AM: ❯ Flags
5:51:14 AM: baseRelDir: true
5:51:14 AM: buildId: 64fa9a052d4e3400086fb43f
5:51:14 AM: deployId: 64fa9a052d4e3400086fb441
5:51:14 AM: ​
5:51:14 AM: ❯ Current directory
5:51:14 AM: /opt/build/repo
5:51:14 AM: ​
5:51:14 AM: ❯ Config file
5:51:14 AM: /opt/build/repo/netlify.toml
5:51:14 AM: ​
5:51:14 AM: ❯ Context
5:51:14 AM: production
5:51:14 AM: ​
5:51:14 AM: ❯ Installing plugins
5:51:14 AM: - @netlify/plugin-lighthouse@5.0.0
5:51:26 AM: ​
5:51:26 AM: ❯ Loading plugins
5:51:26 AM: - @netlify/plugin-lighthouse@5.0.0 from Netlify app
5:51:27 AM: ​
5:51:27 AM: Build command from Netlify app
5:51:27 AM: ────────────────────────────────────────────────────────────────
5:51:27 AM: ​
5:51:27 AM: $ yarn run build
5:51:28 AM: yarn run v1.22.19
5:51:28 AM: $ tsc && vite build
5:51:29 AM: vite v4.4.9 building for production…
5:51:29 AM: transforming…
5:51:30 AM: ✓ 31 modules transformed.
5:51:30 AM: rendering chunks…
5:51:30 AM: computing gzip size…
5:51:30 AM: dist/index.html 0.46 kB │ gzip: 0.29 kB
5:51:30 AM: dist/assets/index-36e0e3dd.css 2.36 kB │ gzip: 0.94 kB
5:51:30 AM: dist/assets/index-34a4bfc4.js 145.20 kB │ gzip: 47.08 kB
5:51:30 AM: ✓ built in 973ms
5:51:30 AM: Done in 2.46s.
5:51:30 AM: ​
5:51:30 AM: (build.command completed in 2.7s)
5:51:30 AM: ​
5:51:30 AM: Functions bundling
5:51:30 AM: ────────────────────────────────────────────────────────────────
5:51:30 AM: ​
5:51:30 AM: Packaging Functions from functions directory:
5:51:30 AM: - connection.js
5:51:30 AM: - database.js
5:51:30 AM: ​
5:51:31 AM: ​
5:51:31 AM: Internal error during Functions bundling
5:51:31 AM: ────────────────────────────────────────────────────────────────
5:51:31 AM: ​
5:51:31 AM: Error message
5:51:31 AM: RangeError: Maximum call stack size exceeded
5:51:31 AM: ​
5:51:31 AM: Error location
5:51:31 AM: During Functions bundling
5:51:31 AM: at Map.has ()
5:51:31 AM: at shouldTranspile (file:///opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/nft/es_modules.js:58:15)
5:51:31 AM: at file:///opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/nft/es_modules.js:78:67
5:51:31 AM: at Array.every ()
5:51:31 AM: at shouldTranspile (file:///opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/nft/es_modules.js:78:45)
5:51:31 AM: at file:///opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/nft/es_modules.js:78:67
5:51:31 AM: at Array.every ()
5:51:31 AM: at shouldTranspile (file:///opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/nft/es_modules.js:78:45)
5:51:31 AM: at file:///opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/nft/es_modules.js:78:67
5:51:31 AM: at Array.every ()
5:51:31 AM: ​
5:51:31 AM: Resolved config
5:51:31 AM: build:
5:51:31 AM: command: yarn run build
5:51:31 AM: commandOrigin: ui
5:51:31 AM: environment:
5:51:31 AM: - HOST
5:51:31 AM: - OPENAIAPI
5:51:31 AM: - PASSWORD
5:51:31 AM: publish: /opt/build/repo/dist
5:51:31 AM: publishOrigin: ui
5:51:31 AM: functionsDirectory: /opt/build/repo/functions
5:51:31 AM: plugins:
5:51:31 AM: - inputs: {}
5:51:31 AM: origin: ui
5:51:31 AM: package: ‘@netlify/plugin-lighthouse’
5:51:32 AM: Caching artifacts
5:51:32 AM: Started saving node modules
5:51:32 AM: Finished saving node modules
5:51:32 AM: Started saving build plugins
5:51:32 AM: Finished saving build plugins
5:51:32 AM: Started saving corepack cache
5:51:32 AM: Finished saving corepack cache
5:51:32 AM: Started saving yarn cache
5:51:38 AM: Finished saving yarn cache
5:51:38 AM: Started saving pip cache
5:51:38 AM: Finished saving pip cache
5:51:38 AM: Started saving emacs cask dependencies
5:51:38 AM: Finished saving emacs cask dependencies
5:51:38 AM: Started saving maven dependencies
5:51:38 AM: Finished saving maven dependencies
5:51:38 AM: Started saving boot dependencies
5:51:38 AM: Finished saving boot dependencies
5:51:38 AM: Started saving rust rustup cache
5:51:38 AM: Finished saving rust rustup cache
5:51:38 AM: Started saving go dependencies
5:51:38 AM: Finished saving go dependencies
5:51:38 AM: Build failed due to an internal system error: Build script returned non-zero exit code: 4
5:51:38 AM: Failing build: Failed to build site
5:51:39 AM: Finished processing build request in 1m7.97s

Hi @TWoolff,

Welcome to the forums! :tada:

Could you please take a look at these linked articles and see if they help your issue?

I hope this helps!

This is a duplicate of: Netlify scheduled serverless functions not getting deployed - #11 by hrishikesh. Since your repo is open-source, I have shared that with the devs.

I get the max call stack error from the openai import, so sadly it has nothing to do with my code.

same error I’m unable to deploy my application

This should now be fixed.