Mongoose - Bun - Elysia - TCP Socket Issue


I need help with this issue: Mongo Socket continuously closes connection, so, I’m assuming the keepAlive socket property isn’t working as it should.

error: connection 2 to host:27017 closed

I temporarily fixed this by reading anything from DB every 30 seconds, although it may not be the best solution for a Atlas Serverless solution given that every read costs.

setInterval(async () => await App.findById("anything"), 30000)


Mongoose 8.2.0
Bun 1.0.28
Elysia 0.8.17

Hi there

Can you please provide:

  1. Timestamps and timezone for when this issue is happening
  2. The URL to your serverless instance?


URL: mongodb+srv://ethos-api:*****

I haven’t implemented timestamps for errors, my bad, I just added and deployed that, so, I’m gonna wait for socket connection to close, I’ll post the timestamp here when I can catch a new error.


Timestamp 1709156721
ISO 2024-02-28T15:45:21-06:00

let me message you over DM as the URL pasted above is incorrect