Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

586
Views
aws-serverless-express connection error - socket hangup

I have a lambda function accessed via API gateway. The function receives username and password and performs authentication on a given active directory.

If the user is found then it calls the database to fetch the user by username > generates JWT and returns it in the response.

For last few days I have been getting CORS errors on the login page. On further inspection of the CloudWatch logs I see these errors

{
    "errno": "ETIMEDOUT",
    "code": "ETIMEDOUT",
    "syscall": "connect",
    "address": "10.1.2.39",
    "port": 389
}
error.code Error: connect ETIMEDOUT 10.1.2.39:389    
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) 
{  errno: 'ETIMEDOUT',  code: 'ETIMEDOUT',  syscall: 'connect',  address: '10.1.2.39',  port: 389}
ERROR: aws-serverless-express connection error

ERROR   Error: socket hang up    
at connResetException (internal/errors.js:609:14)    
at Socket.socketOnEnd (_http_client.js:458:23)    
at Socket.emit (events.js:326:22)    
at endReadableNT (_stream_readable.js:1241:12)    
at processTicksAndRejections (internal/process/task_queues.js:84:21) {  code: 'ECONNRESET'}

The weird thing is, when I try to log into the application for the first time, I get these errors, but let's say I wait for some 15-20 minutes and then try logging again, no error appears and I am logged in smoothly.

The AD is maintained by the customer and they claim nothing is wrong on their end. This issue started happening recently even though the application has been in production for the last six months.

I am using the activedirectory module for AD authentication. If I run a simple authenticate code locally with the same username and password then it works so there is no problem with AD authentication or the credentials.

I am using Node 12 in my lambda. Also I am using aws-serverless-koa and not express so I am assuming that the error is coming from some dependency (probably activedirectory).

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!