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

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

Open
JClackett opened this issue Oct 2, 2024 · 3 comments
Open

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

JClackett opened this issue Oct 2, 2024 · 3 comments
Labels
bug Issue was opened via the bug report template. Navigation Related to Next.js linking (e.g., <Link>) and navigation. Runtime Related to Node.js or Edge Runtime with Next.js. Webpack Related to Webpack with Next.js.

Comments

@JClackett
Copy link
Contributor

JClackett commented Oct 2, 2024

Link to the code that reproduces this issue

https://github.com/JClackett/next-server-actions

To Reproduce

Getting this consistently in production only and only for certain users

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

message: Cannot read properties of undefined (reading 'call'),
name: TypeError,
stack: TypeError: Cannot read properties of undefined (reading 'call') at l
(<url>/_next/static/chunks/webpack-0062ff542f3d788d.js?

I posted an issue a while back and am still struggling to get a repro, but it's consistently happening. I can see its happening on certain actions but when I test those in production it doesnt error, so im assuming its something to do with a user's browser maybe?

#67208

Looking into the sources there's one webpack file generated and there are 2 references to .call

try {
            f[e].call(n.exports, n, n.exports, l),
            r = !1
        } finally {
            r && delete d[e]
        }

and

   l.o = function(e, t) {
        return Object.prototype.hasOwnProperty.call(e, t)
    },

I can see from the session replays that the server action isnt even being called, it throws an error on the client straight away as soon as the form is submitted.

Current vs. Expected behavior

Server actions dont throw exceptions

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 8
Binaries:
  Node: 18.20.4
  npm: 10.7.0
  Yarn: 1.22.19
  pnpm: 8.15.7
Relevant Packages:
  next: 14.2.14 // Latest available version is detected (14.2.14).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.6.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Navigation, Runtime, Webpack

Which stage(s) are affected? (Select all that apply)

Vercel (Deployed)

Additional context

Deployed on vercel, production only.

@JClackett JClackett added the bug Issue was opened via the bug report template. label Oct 2, 2024
@github-actions github-actions bot added Navigation Related to Next.js linking (e.g., <Link>) and navigation. Runtime Related to Node.js or Edge Runtime with Next.js. Webpack Related to Webpack with Next.js. labels Oct 2, 2024
@samcx
Copy link
Member

samcx commented Oct 2, 2024

@JClackett Thank you for submitting an issue!

I was not able to replicate the issue when deployed on Vercel.

so im assuming its something to do with a user's browser maybe?

.call() is supported by many browsers, so not sure if that is the case.

Is the :repro: supposed to replicate the error all the time?

@JClackett
Copy link
Contributor Author

@samcx Not all the time no, it seems to happen very sporadically for me.

yeah but what is .call() being called on in this webpack file?

for example, in:

f[e].call(n.exports, n, n.exports, l),

f[e] could be returning undefined.

@samcx
Copy link
Member

samcx commented Oct 2, 2024

@JClackett Can you share a screenshot (or recording) when you receive this error? Not able to replicate it even sporadically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Navigation Related to Next.js linking (e.g., <Link>) and navigation. Runtime Related to Node.js or Edge Runtime with Next.js. Webpack Related to Webpack with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants