I'm experiencing a problem with Drizzle ORM and Vercel’s Postgres (which I believe is Neon Postgres under the hood) in my SvelteKit application deployed on Vercel. Everything functioned perfectly until I tried to transition my request handling to edge functions using prepared statements.
Here’s what I've implemented: 1. Defined a prepared statement in a separate file:
2. Executed the prepared statement in the request handler:
getPublishedJokesPrep.execute();
getPublishedJokesPrep.execute();
The first execution works fine, but subsequent ones trigger a “prepared statement already exists” error. It seems each request to the handler tries to recreate the prepared statement.