Could not get any response socket hang up

I am not able to Post to the server. I am receiving “Could not get any response” error. While checking the logs found the following:

POST http://localhost:3000/posts

Error: socket hang up

Warning: This request did not get sent completely and might not have all the required system headers

:arrow_forward:Request Headers

Content-Type: application/json

User-Agent: PostmanRuntime/7.24.0

Accept: /

Postman-Token: 0e027767-78e2-456f-a04f-d760d646ae75

Host: localhost:3000

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Hi @kundala.d

Welcome to the community :wave:

Could you check out the following response in other thread and see if this helps?

Hi [subramanya.raj, I don’t have an option for global configuration under settings. Tried giving the custom configuration but the shows proxy server 127.0.0.1 is invalid. can you please help? My postman version is : Version 7.21.1

Hey, yes! So this was recent update in the app where the global configuration section was renamed to “Proxy configurations for sending requests”. It does show invalid when you enter “127.0.0.1” - click on port number and that warning should be gone once validated. If you’ve gone through the entire video, which shows settings based on various configurations done by the end-users.

Here is my configuration, do give a try and see if that works :slight_smile:

Yes, I had done that but there was no luck. I was still getting the same error. I even disabled the SSL certification verification.

Hey @kundala.d,

Thanks for following up. Hopefully, the following suggestions may help troubleshoot further. Could you confirm if the local server is running and listening on port 3000 as mentioned in your initial post? ( I’d confirm by attempting to check on the browser to see if it can be accessed )

Also, could you try switching on the Use the system proxy and see if it helps? Screenshot attached for further guidance.

Hopefully, this helps and don’t hesitate to follow-up to let us know.

1 Like

In addition to that, from the attached screenshot - we see you’ve used Port number as 443 - which isn’t your configuration (I believe). Your port number should be 3000 - could you give that a try? Also, retry sending request by selecting “Http” there.

1 Like

Hi @SabriH, I have tried the above suggestion. Still it didn’t resolve the issue. My server is up and running with the port 3000. Please find the screenshot for the same along with the log and the proxy settings.

Hi @Kurmavatar, Thank you for pointing that out. I have tried changing the port now but still the issue persists.

HI
I have encountered the same issue. Could you please let me know if you have solved it ?
Tried all the possibilites of the above steps but still the issue exists.

Thank you.

HI

I have encountered with the same issue,
Attaching the above said steps but still getting the same errror.
ANy solouting which you can suggest?

Screenshot 2020-07-01 at 3.29.34 PM|690x444 !

same problem here, it doesn´t work with any configuration
, I´m doing the Dev Ed youtube tutorial for a rest-api.

Please if somebody can help us with this problem.

1 Like

same problem :-
proxy is disabled and no vpn set up.

I’m having the same issue with the Dev Ed tut as well.

Hi Stephanie, let me tell you what I did :)…I just found another video about the same topic, it’s just more recent, about three weeks ago, it’s call “Build A RESTful Api With Node.js Express & MongoDB” it’s from Can Dev and it works

Thank you so much! I’ll check it out :slight_smile:

had similar issues but this was due to an invalid response. Tried to pass numeric data (arr.length) directly in .send.

would suggest to check your input and possibly stringify…

Had similar issue - when I was trying to get huge response - the issue was solved by adding gzip / compression to the application .

If you are using nodemon, try running your app with just node instead and see if it resolves it. After the last nodemon update (2.04) I noticed some course examples stopped working (POST/req.body), which was resolved by running the js file straight through node. I switched to npm/supervisor instead of nodemon and everything now works fine.

linux/x64 node v10.19.0 / npm v6.14.8 / nodemon 2.0.4 / supervisor v0.12.0

I created an account specifically to post this.

I too was having a problem following Dev Ed’s tutorial.

Here is what you code probably looks like, and what it SHOULD look like which fixed it (the commented out line)

try {
    const savedUser = await user.save();
    // The below line fixed it for me! In Dev Ed's tutorial he doesn't send a response!
    res.json(savedUser);
} catch (err) {
    res.status(400).send(err);
}
2 Likes