Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR Maximum call stack size exceeded #19783

Closed
shba007 opened this issue Mar 18, 2023 · 28 comments
Closed

ERROR Maximum call stack size exceeded #19783

shba007 opened this issue Mar 18, 2023 · 28 comments

Comments

@shba007
Copy link

shba007 commented Mar 18, 2023

Environment


  • Operating System: Windows_NT
  • Node Version: v18.15.0
  • Nuxt Version: 3.3.1
  • Nitro Version: 2.3.1
  • Package Manager: npm@9.5.0
  • Builder: vite
  • User Config: modules, imports, runtimeConfig, typescript, app, nitro
  • Runtime Modules: @nuxt/devtools@0.2.5, @nuxtjs/robots@3.0.0, @nuxtjs/tailwindcss@6.6.0, @pinia/nuxt@0.4.7, @vueuse/nuxt@9.13.0, nuxt-icons@3.1.0, nuxt-vitest@0.6.8
  • Build Modules: -

Reproduction

On a large project small project does not have this problem

Describe the bug

nuxt dev works fine but nuxt build failed

message
ERROR Maximum call stack size exceeded

Additional context

No response

Logs

Nuxi 3.3.1                                                                                                     11:23:50
Nuxt 3.3.1 with Nitro 2.3.1                                                                                    11:23:50
i Using default Tailwind CSS file from runtime/tailwind.css                                   nuxt:tailwindcss 11:23:51
i Building client...                                                                                           11:23:52
i vite v4.1.4 building for production...                                                                       11:23:52
i ✓ 400 modules transformed.                                                                                   11:23:55  

 ERROR  Maximum call stack size exceeded                                                                       11:23:55  


 ERROR  Maximum call stack size exceeded                                                                       11:23:55  

  at Set.has (<anonymous>)
  at ParameterVariable.deoptimizePath (/D:/Algostract/Orykit/store-web/node_modules/rollup/dist/es/shared/node-entry.js:6801:57)
  at Identifier.deoptimizePath (/D:/Algostract/Orykit/store-web/node_modules/rollup/dist/es/shared/node-entry.js:8149:24)
  at ObjectEntity.deoptimizeArgumentsOnInteractionAtPath (/D:/Algostract/Orykit/store-web/node_modules/rollup/dist/es/shared/node-entry.js:6051:22)
  at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (/D:/Algostract/Orykit/store-web/node_modules/rollup/dist/es/shared/node-entry.js:8597:36)
  at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (/D:/Algostract/Orykit/store-web/node_modules/rollup/dist/es/shared/node-entry.js:8973:15)
  at ParameterVariable.addEntityToBeDeoptimized (/D:/Algostract/Orykit/store-web/node_modules/rollup/dist/es/shared/node-entry.js:6779:20)
  at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (/D:/Algostract/Orykit/store-web/node_modules/rollup/dist/es/shared/node-entry.js:8589:45)
  at FunctionExpression.deoptimizeArgumentsOnInteractionAtPath (/D:/Algostract/Orykit/store-web/node_modules/rollup/dist/es/shared/node-entry.js:8973:15)
  at ParameterVariable.addEntityToBeDeoptimized (/D:/Algostract/Orykit/store-web/node_modules/rollup/dist/es/shared/node-entry.js:6779:20)
@danielroe
Copy link
Member

Would you provide a reproduction? 🙏

@bcspragu
Copy link

Not chiming in with anything particularly useful, but I hit the same thing after updating to 3.3.1:

 ERROR  Maximum call stack size exceeded                                                                                                                                                         11:12:39

  at ObjectEntity.deoptimizeArgumentsOnInteractionAtPath (node_modules/rollup/dist/es/shared/node-entry.js:6054:30)
  at ObjectExpression.deoptimizeArgumentsOnInteractionAtPath (node_modules/rollup/dist/es/shared/node-entry.js:11529:32)
  at node_modules/rollup/dist/es/shared/node-entry.js:6638:83
  at PathTracker.withTrackedEntityAtPath (node_modules/rollup/dist/es/shared/node-entry.js:1784:24)
  at LocalVariable.deoptimizeArgumentsOnInteractionAtPath (node_modules/rollup/dist/es/shared/node-entry.js:6638:26)
  at Identifier.deoptimizeArgumentsOnInteractionAtPath (node_modules/rollup/dist/es/shared/node-entry.js:8141:23)
  at ParameterVariable.addEntityToBeDeoptimized (node_modules/rollup/dist/es/shared/node-entry.js:6779:20)
  at ArrowFunctionExpression.deoptimizeArgumentsOnInteractionAtPath (node_modules/rollup/dist/es/shared/node-entry.js:8589:45)
  at ParameterVariable.addEntityToBeDeoptimized (node_modules/rollup/dist/es/shared/node-entry.js:6779:20)
  at ArrowFunctionExpression.deoptimizeArgumentsOnInteractionAtPath (node_modules/rollup/dist/es/shared/node-entry.js:8589:45)

It's unclear if it happens consistently on the same transforming <module> in Vite, just some module around 750 or so. It also failed on 3.3.0 and 3.2.3, I had to downgrade to 3.1.2 to get it working again, at which point I hit #19717, which I fixed with #19717 (comment). This is a pure Nuxt 3 project, no Nuxt 2 or bridge.

@danielroe
Copy link
Member

danielroe commented Mar 18, 2023

I have had a report that a similar issue is due to a rollup upgrade; we'll need to investigate but that is the most likely scenario.

@abaskalov
Copy link

In my case the reason was
import { useChangeCase } from '@vueuse/integrations/useChangeCase'

Replace with direct import resolve the error
import { camelCase } from "change-case";

@gorkie
Copy link

gorkie commented Mar 19, 2023

Same for me 🥺

@warflash
Copy link
Member

Related: unjs/nitro#1063, rollup/rollup#4904
Pinning rollup to 3.18.0 fixes the issue as a workaround

@hi-reeve
Copy link

Related: unjs/nitro#1063, rollup/rollup#4904 Pinning rollup to 3.18.0 fixes the issue as a workaround

this won't work with v3.3.2
upgrading to 3.3.2 breaks it even with pinning rollup to 3.18.0

@danielroe
Copy link
Member

Would you please provide a reproduction? 🙏

@gorkie

This comment was marked as duplicate.

@ddahan

This comment was marked as duplicate.

@ddahan
Copy link

ddahan commented Apr 3, 2023

this won't work with v3.3.2 upgrading to 3.3.2 breaks it even with pinning rollup to 3.18.0

To be more specific about the workaround, it works with Nuxt 3.3.0 (not 3.3.1 nor 3.3.2) and rollup 3.18.0. Note that you may need to remove other packages like nuxt-devtools which requires Nuxt 3.3.1 as a dependency.

@danielroe
Copy link
Member

@ddahan Would you be able to provide a reproduction? 🙏 The workaround has worked for others running Nuxt 3.3.1, as you see above.

@ddahan
Copy link

ddahan commented Apr 3, 2023

@danielroe I tried using a stackblitz with the same packages than in local but was unable to reproduce the issue.
At this point I'm wondering if it could be related to something specific to my local environment, like the fact it lives in a docker container.
EDIT: I'm unable to deploy to Render with the same project, so it's should not be related to local specific config after all...

@Vesely
Copy link

Vesely commented Apr 3, 2023

@danielroe there is a reproduction: https://stackblitz.com/edit/nuxt-starter-6usrbo?file=components/TestFailing.vue (nuxt 3.3.3 + nuxt-lodash)
You can run yarn build to see the error. There are two components, TestFailing.vue and TestWorking.vue, critical is this code @click="emit('open', useCloneDeep(schema))" if you remove it build will pass.

@ddahan
Copy link

ddahan commented Apr 4, 2023

Not sure this will really help, but when trying to build a reproduction, I noticed something similar: by removing a single call in one of my component (in my case: useSeoMeta), I was able to remove the error when building. However in some other cases, I was not able to directly tie a single line of code to the error itself. I concluded that the single line was not directly responsible of the error. As the error suggests, some calls might increase call stack size more than others.
Again, it's just pure supposition.

@hi-reeve
Copy link

hi-reeve commented Apr 6, 2023

@danielroe there is a reproduction: https://stackblitz.com/edit/nuxt-starter-6usrbo?file=components/TestFailing.vue (nuxt 3.3.3 + nuxt-lodash) You can run yarn build to see the error. There are two components, TestFailing.vue and TestWorking.vue, critical is this code @click="emit('open', useCloneDeep(schema))" if you remove it build will pass.

i can confirm this work now with 3.3.3 even with nuxt lodash

Copy link
Member

@hi-reeve Can you share more information? I can still reproduce with the provided reproduction even with latest Nuxt edge.

@hi-reeve
Copy link

hi-reeve commented Apr 9, 2023

@hi-reeve Can you share more information? I can still reproduce with the provided reproduction even with latest Nuxt edge.

updated to 3.3.3 and removing the pinned rollup 3.18 solved the issue for me.

my package.json

 "devDependencies": {
        "@commitlint/cli": "^17.5.1",
        "@commitlint/config-conventional": "^17.4.4",
        "@nuxt/eslint-config": "^0.1.1",
        "@nuxt/image-edge": "1.0.0-28008586.381b906",
        "@nuxt/kit": "^3.3.3",
        "@nuxt/test-utils": "^3.3.3",
        "@nuxtjs/eslint-module": "^4.0.2",
        "@nuxtjs/i18n": "8.0.0-beta.9",
        "@nuxtjs/tailwindcss": "^6.6.5",
        "@pinia-plugin-persistedstate/nuxt": "1.1.1",
        "@rushstack/eslint-patch": "^1.2.0",
        "@types/lodash-es": "^4.17.7",
        "@vee-validate/yup": "^4.8.4",
        "@vite-pwa/nuxt": "^0.0.7",
        "@vitest/coverage-c8": "^0.29.8",
        "@vue-macros/nuxt": "^1.2.8",
        "@vue/runtime-dom": "^3.2.47",
        "@vueuse/core": "^9.13.0",
        "@vueuse/nuxt": "^9.13.0",
        "eslint": "^8.37.0",
        "eslint-plugin-vuejs-accessibility": "^2.1.0",
        "husky": "^8.0.3",
        "nuxt": "^3.3.3",
        "nuxt-icon": "^0.3.3",
        "nuxt-lodash": "^2.4.1",
        "nuxt-typed-router": "^3.0.9",
        "nuxt-vitest": "^0.6.9",
        "prettier": "^2.8.7",
        "sass": "^1.60.0",
        "standard-version": "^9.5.0",
        "ts-toolbelt": "^9.6.0",
        "vite-plugin-vue-type-imports": "^0.2.4"
    },
    "dependencies": {
        "@casl/ability": "^6.4.0",
        "@casl/vue": "^2.2.1",
        "@firebase/app-types": "^0.9.0",
        "@huntersofbook/naive-ui-nuxt": "^0.7.1",
        "@nuxt-alt/proxy": "^2.2.3",
        "@nuxtjs/robots": "^3.0.0",
        "@pinia/nuxt": "^0.4.7",
        "@tanstack/vue-query": "^4.27.0",
        "@tanstack/vue-virtual": "3.0.0-beta.54",
        "@vueuse/motion": "2.0.0-beta.25",
        "axios": "^1.3.5",
        "change-case": "^4.1.2",
        "date-fns": "^2.29.3",
        "date-fns-tz": "^2.0.0",
        "firebase": "^9.19.1",
        "firebase-admin": "^11.5.0",
        "jwt-decode": "^3.1.2",
        "maska": "^2.1.7",
        "nanoid": "^4.0.2",
        "pinia": "^2.0.33",
        "pinia-plugin-persistedstate": "^3.1.0",
        "vee-validate": "^4.8.4",
        "yup": "^1.0.2",
        "zod": "^3.21.4"
    }

my nuxt.config.ts

import { i18n } from './config/i18n';
// https://nuxt.com/docs/api/configuration/nuxt-config

export default defineNuxtConfig({
    typescript: {
        includeWorkspace: true,
        tsConfig: {
            include: ['../**/*.d.ts'],
        },
    },
    runtimeConfig: {
        public: {
            firebase: {
                apiKey: process.env.NUXT_FIREBASE_API_KEY,
                authDomain: process.env.NUXT_FIREBASE_AUTH_DOMAIN,
                projectId: process.env.NUXT_FIREBASE_PROJECT_ID,
                storageBucket: process.env.NUXT_FIREBASE_STORAGE_BUCKET,
                messagingSenderId:
                    process.env.NUXT_FIREBASE_MESSAGING_SENDER_ID,
                appId: process.env.NUXT_FIREBASE_APP_ID,
            },
        },
    },
    //@ts-ignore
    modules: [
        '@nuxtjs/i18n',
        'nuxt-icon',
        '@nuxtjs/tailwindcss',
        '@vueuse/nuxt',
        '@nuxt/image-edge',
        'nuxt-typed-router',
        '@nuxtjs/robots',
        '@huntersofbook/naive-ui-nuxt',
        '@vue-macros/nuxt',
        [
            '@pinia/nuxt',
            {
                autoImports: [
                    // automatically imports `defineStore` as `definePiniaStore`
                    ['defineStore', 'definePiniaStore'], // import { defineStore as definePiniaStore } from 'pinia'
                ],
            },
        ],
        '@pinia-plugin-persistedstate/nuxt',
        '@vueuse/motion/nuxt',
        '~/modules/vee-validate',
        '~/modules/yup',
        '~/modules/vue-query/module.ts',
        '~/modules/vue-virtual.ts',
        'nuxt-vitest',
        '@nuxtjs/eslint-module',
        '@nuxt-alt/proxy',
        'vite-plugin-vue-type-imports/nuxt',
        'nuxt-lodash',
    ],
    extends: ['./auth'],
    tailwindcss: {
        cssPath: '~/assets/styles/main.scss',
    },
    lodash: {
        prefix: '_',
        upperAfterPrefix: false,
        prefixSkip: false,
    },
    image: {
        domains: ['images.unsplash.com'],
        alias: { unsplash: 'https://images.unsplash.com' },
    },
    i18n,
    naiveUI: {
        themeOverrides: {},
    },
    css: [],
    vite: {
        define: {
            // "process.env.DEBUG": false,
        },
        plugins: [],
    },
    imports: {
        dirs: ['store', 'services/**', 'composables/**'],
        imports: [
            {
                from: 'axios',
                name: 'axios',
            },
        ],
        injectAtEnd: true,
    },
    routeRules: {
        '/admin/**': { ssr: false },
        '/customer/**': { ssr: false },
        '/profile': { ssr: false },
        '/admin': { redirect: '/admin/dashboard' },
        '/customer': { redirect: '/customer/consignee-list' },
        '/api/auth/logout': { static: true },
    },
    components: [
        {
            path: '~/components',
            extensions: ['.vue'],
        },
        {
            path: '~/components/global',
            global: true,
        },
    ],
    proxy: {
        proxies: {
            '/proxy': {
                target: process.env.API_BASE_URL,
                changeOrigin: true,
                rewrite: (path: string) => path.replace(/^\/proxy/, 'v1/'),
            },
        },
    },
});

@hi-reeve
Copy link

update once more, after few days not error, today i just got the error again on build.
pinning back nuxt to 3.3.1 and rollup to 3.18.0

@kuizuo
Copy link
Contributor

kuizuo commented Apr 12, 2023

Related: unjs/nitro#1063, rollup/rollup#4904 Pinning rollup to 3.18.0 fixes the issue as a workaround

By following these steps, it is able to resolve this issue.

Add the following code in package.json:

"pnpm": {
    "overrides": {
      "rollup": "3.18.0"
    }
  }
}

@ddahan
Copy link

ddahan commented Apr 13, 2023

Did someone find a workaround using Nuxt 3.4?
I'd like to use the new View Transitions API Support, but I'm currently stuck with nuxt 3.3.0 and rollup 3.18.0 as it's the only workaround I found. Thanks.

Copy link
Member

danielroe commented Apr 13, 2023

I can reproduce issue with just lodash-es on its own: https://stackblitz.com/edit/nuxt-starter-7hztxb.

The workaround is still working for Nuxt 3.4.1: https://stackblitz.com/edit/nuxt-starter-wunnhm.

Copy link
Member

A PR to fix this in rollup has been opened.

You can test it by installing rollup@3.20.3-0 or rollup@beta. It resolved the issue for me with the reproduction posted above, but I would be glad to hear other feedback. (Likely also worth commenting on rollup/rollup#4904 if you can confirm it resolves the issue.)

@ddahan
Copy link

ddahan commented Apr 14, 2023

Nope :( Still the same error when running npm run build, using nuxt 3.41 and rollup 3.20.3-0

Copy link
Member

@ddahan In that case it would be very helpful for you to provide a reproduction so your situation can be addressed. (Do ensure that you are using pnpm/npm overrides or yarn resolutions to install the new rollup version as otherwise you may not be testing the fix.)

@ddahan
Copy link

ddahan commented Apr 14, 2023

@danielroe you were right I wasn't using overrides the right way. I don't have the issue anymore.

@danielroe
Copy link
Member

This issue has now been resolved in rollup@3.20.3 - you can refresh your lockfile to pull it in.

@warflash
Copy link
Member

warflash commented Jul 1, 2023

@davvvvsss I recommend opening a new issue along side a reproduction if you're running into that error message again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests