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.

Getting "TypeError [ERR_INVALID_ARG_TYPE]: The "timeout" argument must be of type number. Received an instance of Object" when using "got"

See original GitHub issue

When using msw on node for requests created by got I’ll get the following error.

    at validateNumber (internal/validators.js:129:11)
    at getTimerDuration (internal/timers.js:381:3)
    at new ClientRequest (_http_client.js:170:20)
    at request (http.js:50:10)
    at Object.proxiedOriginalRequest (./node_modules/node-request-interceptor/src/interceptors/ClientRequest/index.ts:67:29)
    at ClientRequestOverride.<anonymous> (./node_modules/node-request-interceptor/src/interceptors/ClientRequest/ClientRequestOverride.ts:268:15)
    at step (./node_modules/node-request-interceptor/lib/interceptors/ClientRequest/ClientRequestOverride.js:33:23)
    at Object.next (./node_modules/node-request-interceptor/lib/interceptors/ClientRequest/ClientRequestOverride.js:14:53)
    at fulfilled (./node_modules/node-request-interceptor/lib/interceptors/ClientRequest/ClientRequestOverride.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

The initial requested created by me doesn’t even contain a timeout value. I’ve created a minimal repo to showcase the error: https://github.com/KnisterPeter/node-request-interceptor-with-got-issue

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kettanaitocommented, Mar 23, 2021

@QuentinDejean, hey. This has already been released under @mswjs/interceptors. We have renamed the package because it no longer deals with Node.js interception exclusively. Migrate from node-request-interceptor to the aforementioned package and you will have the fix.

MSW users note: if you’re experiencing this issue in MSW, please await the next release that should happen this month. Thanks.

1reaction
QuentinDejeancommented, Mar 23, 2021

Hey @kettanaito , thanks for the update, great stuff! May I know when is the next release happening? We’d love to take advantage of this feature as soon as it’s done!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "TypeError [ERR_INVALID_ARG_TYPE]: The "timeout ...
Getting "TypeError [ERR_INVALID_ARG_TYPE]: The "timeout" argument must be of type number. Received an instance of Object" when using "got" #86.
Read more >
TypeError [ERR_INVALID_ARG_TYPE] WHY IS THIS ...
I recreated your error. Your code is completely valid and works as long as you pass writeParams a valid Javascript object.
Read more >
typeerror [err_invalid_arg_type]: the "data" argument must be ...
I try to use it with a simple tempate and I have got the error Quickadd : (error) TypeError [ERRINVALIDARG_TYPE]: the "data" argument...
Read more >
Stream | Node.js v19.3.0 Documentation
Stream instances are switched into object mode using the objectMode option ... ServerResponse, which is a writable stream. let body = ''; //...
Read more >
node-mssql | Microsoft SQL Server client for Node.js
server: 'localhost', // You can use 'localhost\\instance' to connect to named instance ... NOTE: To get number of rows affected by the statement(s), ......
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