You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just noticed that in the provided example for Vercel Edge functions, pool connections are not closed for every return path:
import{Pool}from'@neondatabase/serverless';exportdefaultasync(req: Request,ctx: any)=>{constpool=newPool({connectionString: process.env.DATABASE_URL});constpostId=parseInt(newURL(req.url).searchParams.get('postId'),10);if(isNaN(postId)){// --> pool connection is not closed herereturnnewResponse('Bad request',{status: 400});}const[post]=awaitpool.query('SELECT * FROM posts WHERE id = $1',[postId]);if(!post){// --> connection is not closed here eitherreturnnewResponse('Not found',{status: 404});}ctx.waitUntil(pool.end());returnnewResponse(JSON.stringify(post),{headers: {'content-type': 'application/json'}});}exportconstconfig={runtime: 'edge',regions: ['iad1'],// specify the region nearest your Neon DB};
I was wondering if there is a reason for this or if this may be a mistake.
The text was updated successfully, but these errors were encountered:
I just noticed that in the provided example for Vercel Edge functions, pool connections are not closed for every return path:
I was wondering if there is a reason for this or if this may be a mistake.
The text was updated successfully, but these errors were encountered: