Remix-app (Postgres, Prisma) server function timeouts

We have deployed a Remix-based stack (Postgres + Remix + Prisma) and here is a marked difference between the performance of the app using Netlify dev, versus the production deploy.

As we’re quite new to serverless and the Netlify platform, we could use some pointers.

The DB is hosted by Supabase, and we connect to it through connection pooling (pgBouncer), using Prisma on the app side.

First thing that is noticeable is the init time in the function log, which is regularly over 1s. Also, requests that take a couple of seconds in the dev setup regularly hit the time-out, even after bumping that to the max. Memory usage seems to be consistently around 150MB.

Which suggests there is an another problem at play here. The website is

Any insights one could share?

This timing highly depends on your function bundle size. If you have a lot of dependencies bundled into a single function, it takes much longer for AWS to be able to boot your container, load everything to the memory and process it. Can you try splitting your content to see if it helps?

Could you share an example repo that we can test to check the timeout issue?

Turns out the DB instance and functions were in different AWS regions (with an ocean in between), so moving the functions to a different region did the trick.

As seen here: [Support Guide] Why is my function timing out?

Gonna keep an eye on the bundle size, but we fixed the timeouts at least by moving AWS regions.