Best Method for Connecting to Neon from Serverless Functions Using Drizzle ORM
I'm building a Remix app hosted on Vercel and also running some AWS Lambda functions. I'm trying to determine the best way to connect to my Neon database using Drizzle ORM in a serverless environment.
Currently, I'm evaluating two approaches:
Here are the options I am currently looking at.
Option 1: WebSocket Connection
Option 2: HTTP Connection
I'm looking for advice on the pros and cons of each approach, particularly in the context of high-concurrency workloads. For example, in a scenario where many AWS Lambda functions are triggered simultaneously to handle a high volume of incoming webhooks—each requiring a DB query—is there a recommended approach?
Any input or experience with either method would be really appreciated!
2 Replies
equal-aqua•5mo ago
@Jake
https://github.com/neondatabase/examples/tree/main/with-nextjs-drizzle-edge here's an example that you'd want to use with Serverless Functions.
GitHub
examples/with-nextjs-drizzle-edge at main · neondatabase/examples
Examples and code snippets demonstrating common ways of integrating Neon with various frameworks and languages. - neondatabase/examples
equal-aqua•5mo ago
TLDR: the http method