NextJS: The "superCtor" argument must be of type function
See original GitHub issueHi, I am using msw with nextjs and I came across an error when working on the api route. The error log points to this library so I’m here.
Steps to reproduce
here is a minimal repo: https://github.com/dpyzo0o/next-msw-bug-demo
yarn dev
, which enables msw. Then try to clickdownload image
, the first time it will probably succeed (sometimes it also fails the first time). Then do a hard refresh of the page and click download image again. This time it will error out, the error message shown below points tonode-request-interceptor
- If you build the app with
yarn build && yarn start
, which basically disables msw, it will never throw this error and everything works.
I’d really appreciate it if you could help me.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
The "superCtor" argument must be of type function. Received ...
I have a theory that this is caused by the bundling/minifying of the server code into a single file ( __sapper__/dev/server.js ), not...
Read more >typeerror [err_invalid_arg_type]: the "cb" argument must be of ...
Issue: [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object. Asked Jun 17, 2020 • 2 votes 1...
Read more >msw: Versions - Openbase
Fixes an issue that resulted into “The “superCtor” argument must be of type function ”error message when using setupServer ...
Read more >mocha/mocha.js - chromium/src/third_party - Git at Google
throw new TypeError('"listener" argument must be a function');. this.on(type, _onceWrap(this, type, listener));. return this;. }; EventEmitter$2.prototype.
Read more >object prototype may only be an object or null: undefined ...
You might argue that a circular import should be an error or that JavaScript engines should use some other algorithm that correctly handles...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the great work!
Hey, @dpyzo0o. Thanks for reporting this. I’ll look into it sometime next week. Thanks for understanding.