Hello everyone! Congrats for all the work you put ...
# orm-help
a
Hello everyone! Congrats for all the work you put in to prisma, I really love the architecture! I am trying to setup prisma with netlify functions and I have run it to several (netlify) functions timeouts. The problem is that for every request handled by the serverless functions, a new prisma client is instantiated (along with the underlying http server of the prisma engine). I understand that this is totally normal (and not related with prisma), but this is an actual blocker for anyone that wants to deploy prisma in a serverless enviroment. I am wondering, what is the normal "boot" time for the prisma engine? Anyone here had any luck combining prisma with any serverless service? Thanks in advance!
n
Hey @apoeco 👋 thanks a lot for raising this! It seems like the spec for Netlify functions has a 10s execution limit which really shouldn't be a problem for Prisma Client. However, we definitely want to understand more about your issue since deploying applications that use Prisma Client to Netlify functions is a use case that we certainly want to optimize for! Would you mind opening a GitHub issue with as much information as possible about your problem so that our engineering team can look into it? 🙂
Also, just to make sure! It's important to instantiate
PrismaClient
outside of the handler function (this applies as a general rule in serverless environments), this is documented here but admittedly our documentation is lacking quite a bit and not easy to find in that regard. We'll improve that soon! 🙏
You might also want to check out this guide that explains how to deploy to Netlify functions, maybe there are some helpful bits in there for you as well 🙂