next.js: v12.0.1 error: not implemented: regenerator: complex pattern in catch clause
What version of Next.js are you using?
12.0.1
What version of Node.js are you using?
14.15.0
What browser are you using?
chrome
What operating system are you using?
mac
How are you deploying your application?
NODE_OPTIONS=‘–inspect’ next dev
Describe the Bug
I got this error thread '<unnamed>' panicked at 'not implemented: regenerator: complex pattern in catch clause', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_transforms_compat-0.47.1/src/es2015/regenerator/case.rs:1232:30
after upgrade from v11 to v12
Expected Behavior
it should work fine like v11 !
To Reproduce
try { // my code } catch ({ error }: any) { // handling error }
after I remove the try-catch statement everything works fine !
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 16 (7 by maintainers)
This has indeed landed in 12.0.3 👍 thanks for confirming and the reproductions provided!
Hey guys! after a little bit of research, I found that the bug is caused by object destructuring the error recieved in the catch clause of the statement.
So instead of doing this:
Just avoid destructuring:
Hope this solves the problem for everyone. Cheers!
Same issue here with a simple try/catch block in a component’s event handler function.