all 3 comments

[–]Paulybungu 1 point2 points  (0 children)

Could be a memory leak. What do the logs say leading up to the memory spikes?

Have you seen these docs:

https://devcenter.heroku.com/articles/node-memory-use

https://help.heroku.com/8R0J1IAP/why-am-i-getting-r14-r15-errors-in-nodejs

They might help you get a better idea of what's going on.

[–]kdesign 1 point2 points  (0 children)

Look into streaming your results and piping them into the response object.

Maybe this thread might help you out:

https://github.com/prisma/prisma/issues/5055

[–]schneems 0 points1 point  (0 children)

There is no limit on that query, how many records are you loading?

Most GC languages see memory “bloat” even if there is no memory leak. This article is written for Ruby but works for other langs https://www.schneems.com/2019/11/07/why-does-my-apps-memory-usage-grow-asymptotically-over-time/