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


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","reason":{"errorType":"Error","errorMessage":"connect ECONNREFUSED","code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"","port":5432,"stack":["Error: connect ECONNREFUSED"," at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: connect ECONNREFUSED"," 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
This channel has been archived