next.js: onClick not working in fresh project in next 13.4.17

Verify canary release

  • [] I verified that the issue exists in the latest Next.js canary release

Provide environment information

Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.4.16
      eslint-config-next: 13.4.16
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

App Router

Link to the code that reproduces this issue or a replay of the bug

https://github.com/shulinnn/next-reprod

To Reproduce

Use npx create npx create-next-app@latest with app router add onClick handler to whatever element.

Describe the Bug

onClick handler on any element simply doesnt work.

Expected Behavior

Should log “XD” into the console.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 26 (15 by maintainers)

Commits related to this issue

Most upvoted comments

EUREKA! I’ve got it. It is the Node.js version! I tried with 16.13.0, and it broke for me too! Node.js 16.14.0 fixes it!!! 🎉

Not Windows specific at all

Thanks @icyJoseph , nice catch

Uff, this is not looking good. I’ve tried once again, once with TS on, one with only JS, and it works fine. I am using a Macbook.

It also worked on Stackblitz, which would mean it is not a Linux issue. (https://stackblitz.com/edit/nextjs-twgjnr?file=app%2Fpage.js if it crashes just run npm install && npx next dev from the terminal until it works)

I don’t have access to my Windows and Linux machines until Monday. And my Windows machine doesn’t even have a dev env setup 🤔

@ReezanVisram, sorry for asking stuff from you once again, but between 13.4.16 and 13.4.17, there was:

  • 13.4.17-canary.0
  • 13.4.17-canary.1
  • 13.4.17-canary.2

Could you install those, npm install next@13.4.17-canary.0 for example, and try to figure out which one introduced the breakage?

For anyone with an eagle eye: https://github.com/vercel/next.js/compare/v13.4.16...v13.4.17 maybe you can spot which commit might have introduced a Windows specific issue? I see an SWC update, but I’d expect using .babelrc to prevent SWC related issues? Maybe I am wrong there.

@ReezanVisram could you try to verify if the handlers are included in the client bundle? And also try to use babel as described above?