I recently got this socket hang up
problem. I researched for a few days until I found a solution that worked for me. So, maybe this can help.
It worked for me to add the http(s)Agent
property with keepAlive: true
in creating the http client. Here’s an example of what it might look like:
const http = require('http') http.request({ method: 'GET', agent: http.Agent({keepAlive:true}), host: 'www.google.com', })
This property is responsible for managing the sockets for client-side http connections. The justification for using this property can be found here.
I also found an answer on the stackoverflow that also covers the subject, here.
So, I hope this helps.
Related Posts:
- nodemon not working: -bash: nodemon: command not found
- ExpressJS – throw er Unhandled error event
- ExpressJS – throw er Unhandled error event
- npm WARN package.json: No repository field
- How can I update NodeJS and NPM to the next versions?
- How can I update npm itself?
- How to install a previous exact version of a NPM package?
- How to solve npm error “npm ERR! code ELIFECYCLE”
- npm check and update package if needed
- Node.exe Stuck at 100% CPU
- sudo: npm: command not found
- How to resolve Nodejs: Error: ENOENT: no such file or directory
- How do I debug error ECONNRESET in Node.js?
- How do I debug error ECONNRESET in Node.js?
- Please run `npm cache clean`
- What is the difference between npm install and npm run build?
- What is Express.js?
- npm ERR cb() never called
- NPM clean modules
- ‘node’ is not recognized as an internal or an external command, operable program or batch file while using phonegap/cordova
- node.js, Error: Cannot find module ‘express’
- NPM Start not starting local server
- node.js, Error: Cannot find module ‘express’
- nodemon – app crashed – waiting for file changes before starting
- “Topology was destroyed” when using MongoDB with native driver and Express.js
- Error: getaddrinfo ENOTFOUND in nodejs for get call
- What is the –save option for npm install?
- Failed to load resource: net::ERR_CONNECTION_REFUSED : Nodejs
- npm install not working in windows
- nodemon not found in npm
- SyntaxError: Unexpected token import – Express
- nodemon not found in npm
- Error: No default engine was specified and no extension was provided
- Significance of port 3000 in Express apps
- NodeJS / Express: what is “app.use”?
- npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
- How to Create and Use Enum in Mongoose
- What Are “npm run dev” and “npm run prod”
- Find the version of an installed npm package
- First Heroku deploy failed `error code=H10`
- “npm config set registry https://registry.npmjs.org/” is not working in windows bat file
- How to get GET (query string) variables in Express.js on Node.js?
- Error: Cannot find module ‘ejs’
- Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
- First Heroku deploy failed `error code=H10`
- In express how do I redirect a user to an external url?
- ENOENT, no such file or directory
- Error “Cannot find module ‘npmlog'” after “npm update -g”
- What is the difference between –save and –save-dev?
- ExpressJS : res.redirect() not working as expected?
- error: This is probably not a problem with npm. There is likely additional logging output above
- Push items into mongo array via mongoose
- list all globally installed modules with one command in ubuntu
- npm – “Can’t find Python executable “python”, you can set the PYTHON env variable.”
- npm update does not do anything
- Cannot find module ‘@babel/core’
- NodeJS w/Express Error: Cannot GET /
- Express.js req.body undefined
- Enabling HTTPS on express.js
- How to install npm peer dependencies automatically?
- Do I commit the package-lock.json file created by npm 5?
- npm update broke npm
- How to Reinstall Broken npm
- heroku is giving me Method not allowed
- passport.js passport.initialize() middleware not in use
- Cannot npm install due to node-gyp: binding.gyp not found
- Downgrade npm to an older version
- `node-pre-gyp install –fallback-to-build` failed during MeanJS installation on OSX
- npm install resulting in ‘ENOENT: no such file or directory’
- ExpressJS vs MeteorJS
- When I run `npm install`, it returns with `ERR! code EINTEGRITY` (npm 5.3.0)
- Cannot POST / error using express
- Route.get() requires callback functions but got a “object Undefined”
- nodemon not working properly
- E: Unable to locate package npm
- npm install errors with Error: ENOENT, chmod
- NPM self_signed_cert_in_chain
- npm WARN deprecated [email protected]: Use uuid module instead
- Advice on loopback.js vs express js
- npm “failed to parse json”
- Npm Error – Windows NT – How to resolve
- How to update a array value in Mongoose
- How do I use HTML as the view engine in Express?
- Hapi/Joi Validation: How to process text to a specific format
- How to properly upgrade node using nvm
- How do you uninstall all dependencies listed in package.json (NPM)?
- npm start giving error in node.js
- npm install with error: `gyp` failed with exit code: 1
- npm update check failed
- NPM warn message about deprecated package
- While doing npm install getting an error as “No such file or directory open”
- Webpack – webpack-dev-server: command not found
- npm install hangs
- bodyParser is deprecated express 4
- npm init not working and getting stuck on version
- GYP ERR! build error. stack Error: ‘make’ failed with exit code 2
- Can pm2 run an ‘npm start’ script
- Cannot access mongodb through browser – It looks like you are trying to access MongoDB over HTTP on the native driver port
- npm update to specific version (and shrinkwrap)
- nvm is not compatible with the npm config “prefix” option: