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.

Error observed while testing w/ nock

See original GitHub issue

I’m getting the following error when running a test that uses nock.

TypeError: Cannot read property '_redirectable' of undefined
      at eventHandlers.(anonymous function) (node_modules/follow-redirects/index.js:22:7)
      at OverriddenClientRequest.RequestOverrider.req.once.req.on (node_modules/nock/lib/request_overrider.js:195:7)
      at Writable.RedirectableRequest._performRequest (node_modules/follow-redirects/index.js:69:12)
      at Writable.RedirectableRequest (node_modules/follow-redirects/index.js:46:7)
      at Object.wrappedProtocol.request (node_modules/follow-redirects/index.js:202:10)
      at Object.wrappedProtocol.get (node_modules/follow-redirects/index.js:207:33)
      at getLatestUrl (lib/update.js:21:13)
      ...

The error doesn’t happen when I run the program regularly. See this travis build for more context.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
RubenVerborghcommented, Dec 8, 2016

It’s a nock bug: node-nock/nock#769.

0reactions
wathmalcommented, Apr 19, 2017

had the same issue, upgrading to latest version fixed it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error observed while testing w/ nock · Issue #48 · follow-redirects ...
I'm getting the following error when running a test that uses nock. TypeError: Cannot read property '_redirectable' of undefined at eventHandlers.
Read more >
API mock testing with Nock - CircleCI
This tutorial will show you how to mock HTTP requests from an API so that you can test endpoints without really calling them...
Read more >
Nock fails to intercept requests in tests, but only in --coverage ...
I am mocking all the API calls with nock in the tests and all the tests that are supposed to mock a successful...
Read more >
Controlling axios HTTP error handling and test it using nock + ...
Conclusion. In this article I have shown how to control of the axios HTTP client library's error emitting mechanism, and how to set...
Read more >
Mocking HTTP requests with Nock - codeburst
Tests that make real HTTP requests to external services can be error-prone for a variety of reasons. Examples include the exact data returned...
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