Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils.merge not considering/handling the prototype chain #1077

Closed
rupesh1 opened this issue Sep 7, 2017 · 5 comments · Fixed by #2844
Closed

utils.merge not considering/handling the prototype chain #1077

rupesh1 opened this issue Sep 7, 2017 · 5 comments · Fixed by #2844

Comments

@rupesh1
Copy link

rupesh1 commented Sep 7, 2017

#### Summary
Trying to use Axios on Node with your own http(s)Agent set via the global default triggers the error: TypeError: self.agent.addRequest is not a function

For minimal example see: https://runkit.com/rupesh/59b1bcc1efc2f800128b7d54

It seems to be related to utils.merge not considering/handling the prototype chain:
developer_tools_-_node_js

Stack trace:

TypeError: self.agent.addRequest is not a function
at new ClientRequest in core _http_client.js — line 160
at http.Agent in core http.js — line 31
at RedirectableRequest._performRequest in follow-redirects/index.js — line 73
at Writable.RedirectableRequest in follow-redirects/index.js — line 57
at wrappedProtocol.request in follow-redirects/index.js — line 229
at dispatchHttpRequest in axios/lib/adapters/http.js — line 131
at httpAdapter in axios/lib/adapters/http.js — line 18

#### Context

  • axios version: 0.16.2
  • Environment: node v4, 6, 7 and 8
@rupesh1 rupesh1 changed the title TypeError: self.agent.addRequest is not a function when using custom httpAgent TypeError: self.agent.addRequest is not a function when using custom httpAgent from global default Sep 7, 2017
@rupesh1
Copy link
Author

rupesh1 commented Sep 7, 2017

In hindsight this maybe another manifestation of: #812

@KamiKillertO
Copy link

🤔 it's seems that utils.merge erase the httpAgent prototype.

@david4City
Copy link

Anything on this subject ?

@KamiKillertO
Copy link

There's a pending PR (#1295) that should fix this issue.

@cybercussion
Copy link

I got this error on a self-signed cert. Initially I attempted to use httpsAgent: { rejectUnauthorized: false } but then opted to use httpsAgent: new https.Agent({ rejectUnauthorized: false }) and the error went away. Case someone else has that issue.

@chinesedfan chinesedfan changed the title TypeError: self.agent.addRequest is not a function when using custom httpAgent from global default utils.merge not considering/handling the prototype chain Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants