-
Notifications
You must be signed in to change notification settings - Fork 28.3k
[NextJS 14.1.0] TypeError: Cannot read properties of undefined (reading 'call') #61995
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
Comments
Hi, I can't really reproduce... https://stackblitz.com/edit/github-zj7avh?file=src%2Fapp%2Fpage.tsx I wonder if the problem is within your OS or Node.js version? If you run |
Alright, could you try with a Node version in the 18 range? Say 18.18.0? Clean up all of the node_modules and lock file too. |
Here is what I did just now. I still use the node version Step I did try# Clean up the cache
npm cache clean --force
# Delete yarn.lock
rm yarn.lock
# Run dev again
yarn dev I did not see the |
Though this steps did not fix my other project with the same setup. Here is the other project that I am talking about. I have triedI have already tried clearing out the node_modules and the lock files and did a new |
facing the same issue during HMR and navigation when using |
ok when I killed |
Is there a way that we can disable this feature? It is probably like a caching issue. |
I think the service worker gets registered when you do |
I am getting
It happens on Nextj14. My middleware:
|
I'm facing the same error with the app router. I'm calling a function from a client component, then redirecting to a route which is intercepted by a middleware.ts. in development mode, I get: ⨯ TypeError: __webpack_modules__[moduleId] is not a function
at Object.__webpack_require__ [as require] (/.next/server/webpack-runtime.js:33:42) and in production mode, I get: TypeError: Cannot read properties of undefined (reading 'call')
at Object.t [as require] (/home/huilensolis/dev/projects/Pictura/.next/server/webpack-runtime.js:1:143)
at /home/huilensolis/dev/projects/Pictura/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:15:473
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async rc (/home/huilensolis/dev/projects/Pictura/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:14:5243)
at async rj (/home/huilensolis/dev/projects/Pictura/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:15:22333)
at async doRender (/home/huilensolis/dev/projects/Pictura/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1406:30)
at async cacheEntry.responseCache.get.routeKind (/home/huilensolis/dev/projects/Pictura/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1567:28)
at async NextNodeServer.renderToResponseWithComponentsImpl (/home/huilensolis/dev/projects/Pictura/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1475:28)
at async NextNodeServer.renderPageComponent (/home/huilensolis/dev/projects/Pictura/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1852:24)
at async NextNodeServer.renderToResponseImpl (/home/huilensolis/dev/projects/Pictura/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1890:32) my node version: > node -v
v18.18.0 my node architecture: > node -e "console.log(process.arch)"
x64 my os architecture: Linux 6.8.2-arch2- x86_64 GNU/Linux |
This comment has been minimized.
This comment has been minimized.
We're facing the same issue in production. We are hosted on vercel. I believe it's building with Node version 20.11.0 and This error is happening pretty often and slowing down our page load. I attempted running the app in production with node version 18 and I'm still seeing the error. |
Having this a lot in production as well, 14.2.3, node 20.
Chrome 126.0.0 Server action to login in a user, basic form that takes email and password |
I'm having the same problem, nextjs 14.2.15, node 20.15.0 |
I'm having the same problem, nextjs 14.2.15 ( i tries all versions from 14.2.1 => 14.2.15), node v20.16 LTS IRON |
this worked but i cant force my clients to do so , also NODE_ENV=production sort of helped (reduced frequency of occurrence smh) |
Could this have something to do with version skew? I have a setup that allows me to deploy two separate versions at a time and pick which one I want based on a cookie to test what would happen for users after deploying a new version. What I've noticed is if I am on one version of the app and then switch the cookie to the other version, then navigation seems to work fine, but server actions cause this error to occur. I'm trying to track down if it's for all server actions or maybe specific to ones that redirect or revalidate or something. For the record, this is on 14.2.4. The component stack doesn't seem terribly useful as it's all minified code, but it looks something like:
|
OK, I was able to work around this. When I detect that app versions are different and I get a request with From what I understand, NextJS has built-in skew protection like this starting in 14.2.7: #67255 I'll have to play around with it because I don't really see it documented very well unless I'm missing something. But it's unclear to me if this would only work if the client is already on at least 14.2.7, or if the server responds with something that can trigger older versions to treat it as an MPA (like the |
Still getting this in production, assuming it's due to version skew? but as @redbmk suggested, nextjs has something built in? it definitely seems to be around when new versions get deployed, but im not sure how to fix this if next.js skew protection isnt working for me using "next": "14.2.16" + react 18 |
I had a library in my package.json and was also dynamically loading the same library but with a different version, which was causing the issue. https://vercel.com/docs/deployments/skew-protection The solution was to sync the versions of the npm package and the dynamically loaded script. |
I'm on deno and I seem to reliably get this server-side when I update any module. Then doing a reset and a git clean persists the issue. No idea what causes it, and my solution have been going back and forth between versions for an hour or two until something works again. |
I had a hard time getting the built-in skew protection to work. It seems like I tried making the deployment ID something like It seems like middleware would be a decent place to force MPA instead of RSC based on a cookie (e.g. |
It happened a few times locally while recording network requests and starting/stopping the service multiple times for me |
I am having the same error but instead with 'exec', TypeError: Cannot read properties of undefined (reading 'exec') does anybody know a fix for this? |
Having same issue with NextJS `` "next": "15.2.4"``` |
Link to the code that reproduces this issue
https://github.com/dashawk/nextjs-14-bugger
To Reproduce
yarn install && yarn dev
Current vs. Expected behavior
After doing all the reproduction steps, you will see the error. As you can see, I have already applied the suggested fix for

[email protected]
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Data fetching (gS(S)P, getInitialProps), Dynamic imports (next/dynamic), Metadata (metadata, generateMetadata, next/head), Middleware / Edge (API routes, runtime), Module resolution (CJS / ESM, module resolving), Routing (next/router, next/navigation, next/link)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I have encountered this issue only in [email protected] which is giving me a headache.
_
_
The text was updated successfully, but these errors were encountered: