79778491

Date: 2025-09-29 19:56:18
Score: 0.5
Natty:
Report link

Finally found an answer that seems to work. In both the auth.ts and middleware.ts files, the following callback....

callbacks: {
    session({ session, user }) {            
        
        return session
    }
  },

...can be modified to include an explicit pool termination command. (as per the neondatabase/serverless docs)

callbacks: {
    session({ session }) {       
          const client = await pool.connect();
          
          try {
            
            return session

          } catch (e){
            await client.query('ROLLBACK');
            throw e;

          } finally {
            client.release();
            await pool.end();

          }
}
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: thetada