Neon Websocket Connection does not work on Nextjs v15

Configuring the neon serverless driver to connect via pooling and websockets:

import { Pool } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-serverless";

const pool = new Pool({
	connectionString: serverConfig.databaseConnectionString,
});

export const db = drizzle(pool, {});

Getting ‘The edge function timed out’ error as soon as the nextauth middleware (v5) [running on a edge function] tries to connect the database.

Releated: EDGE_FUNCTION_INVOCATION_TIMEOUT when using DrizzleAdapter | timeout Vercel edge functions · Issue #10773 · nextauthjs/next-auth · GitHub

It might have to do with this?

Does this mean I cannot define the connection at application startup?
I need to add the code to build up a new connection at the beginning of every function?

Hi, @lohrm-stabl!

Thank you for being patient with us :pray:

Have you had the chance to read this guide? It talks through what you can do about functions timing out.

Hi,

yes i know that guide but did not help in this case. I think it’s an issue with the neon serverless driver.

Cheers

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.