menu

ZEIT

Our mission is to make cloud computing as easy and accessible as mobile computing. You can find our Next.js community here.

Channels
Team

502 Error for deployed serverless functions

January 9, 2020 at 2:55pm

502 Error for deployed serverless functions

January 9, 2020 at 2:55pm

Hey there!

I'm just figuring out how to use ZEIT's serverless functions as an API to access my MySQL DB. Locally it works like a charm but I'm always getting a 502 error, when deploying my function.

2020-01-09T14:30:29.383Z 9a7c232b-2c81-4093-9620-50a3ebdef663 ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: connect ECONNREFUSED 127.0.0.1:5432","reason":{"errorType":"Error","errorMessage":"connect ECONNREFUSED 127.0.0.1:5432","code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":5432,"stack":["Error: connect ECONNREFUSED 127.0.0.1:5432"," at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: connect ECONNREFUSED 127.0.0.1:5432"," at process.<anonymous> (/var/runtime/index.js:35:15)"," at process.emit (events.js:215:7)"," at process.emit (/var/task/__sourcemap_support.js:2535:21)"," at processPromiseRejections (internal/process/promises.js:201:33)"," at processTicksAndRejections (internal/process/task_queues.js:94:32)"]}END RequestId: 9a7c232b-2c81-4093-9620-50a3ebdef663
Duration: 77.67 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 81 MB
Unknown application error occurred

Did anyone had similar experiences and knows how to fix this? I'm happy for any advice.


February 10, 2020 at 5:01pm

I've been having a similar experience but with a serverless function for api access to my mongodb. Works great in development but gives me a 502 error in production. Would love to see an answer to this post as well.

  • reply
  • like
private
This channel has been archived