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();
}
}
}