question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NextJS: The "superCtor" argument must be of type function

See original GitHub issue

Hi, 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

  1. yarn dev, which enables msw. Then try to click download 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 to node-request-interceptor

Screen Shot 2020-08-19 at 17 16 28

  1. 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:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dpyzo0ocommented, Aug 25, 2020

Thanks for the great work!

1reaction
kettanaitocommented, Aug 22, 2020

Hey, @dpyzo0o. Thanks for reporting this. I’ll look into it sometime next week. Thanks for understanding.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found