DPK
DPK

Reputation: 21

NextJS TypeError: Cannot read properties of undefined (reading 'call')

I am helping develop a NextJS web app, version 12.2.5.

Upon navigating through the website, sometimes (happens kinda randomly) it does a full relead instead of the normal navigation for SPA. The server throws an error:

warn - Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/basic-features/fast-refresh#how-it-works TypeError: Cannot read properties of undefined (reading 'call') at fn (http://localhost:3000/_next/static/chunks/webpack.js?ts=1709383711260:373:21) at eval (webpack-internal:///./img/index.js:122:79)

I've been trying to identify the exact cause of this but have no luck so far. Some things to note:

  1. The app uses a .js file importing and returning all of the images to a single object (/img/index.js)
  2. Images are NOT stored in the public folder
  3. Commenting out all of the imports of the image object file seems to fix the issue.

From my knowledge 1. and 2. should not be a problem, but wanted to share.

The error happens at different lines in the /img/index.js file for different pages. After the reload I am able to navigate to the new desired destination page from the site, this time without any issues.

Upvotes: 2

Views: 712

Answers (1)

Amrit
Amrit

Reputation: 11

Try clearing cookies; it worked for me.

Upvotes: 1

Related Questions