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

Instantiation of Agent without parameter caused an error #12918

Closed
zkd8907 opened this issue May 9, 2017 · 2 comments
Closed

Instantiation of Agent without parameter caused an error #12918

zkd8907 opened this issue May 9, 2017 · 2 comments
Labels
https Issues or PRs related to the https subsystem. question Issues that look for answers.

Comments

@zkd8907
Copy link

zkd8907 commented May 9, 2017

  • Version: found at v7.10.0
  • Platform: 64-bit Windows 10/7
  • Subsystem: https

When I run the code below, it causes an error: Type Error: Cannot read property 'maxCachedSessions' of undefined.

new require('https').Agent();

According to document, The parameter options of new Agent is not required. So I think the error should not be raised.

reference
An Agent object for HTTPS similar to http.Agent. See https.request() for more information. (Class: https.Agent)
new Agent([options]) (new Agent([options]))

@ryan-copperleaf
Copy link

You’re using new on require, not Agent (though new is now being made optional).

new (require('https').Agent)()
// not (new require('https')).Agent()

@mscdex mscdex added https Issues or PRs related to the https subsystem. question Issues that look for answers. labels May 9, 2017
cjihrig added a commit to cjihrig/node that referenced this issue May 11, 2017
Fixes: nodejs#12918
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
cjihrig added a commit that referenced this issue May 11, 2017
Fixes: #12918
PR-URL: #12927
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
anchnk pushed a commit to anchnk/node that referenced this issue May 19, 2017
Fixes: nodejs#12918
PR-URL: nodejs#12927
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@zkd8907
Copy link
Author

zkd8907 commented Jun 8, 2017

@ryan-copperleaf Thanks very much, I think my original understanding of new is problematic. I noticed Node 8.0.0 made an adjustment to solve the problem.

MylesBorins pushed a commit that referenced this issue Jul 17, 2017
Fixes: #12918
PR-URL: #12927
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
https Issues or PRs related to the https subsystem. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

3 participants