uploadthing icon indicating copy to clipboard operation
uploadthing copied to clipboard

feat: expose `waitUntil` for Next.js adapter

Open juliusmarminge opened this issue 1 year ago β€’ 1 comments

Describe the feature you'd like to request

https://vercel.com/docs/functions/functions-api-reference#waituntil

I think it’d be useful to have this exposed in the onUploadComplete callback, since you could do some stuff non-blocking (such as delete an old image for example) without blocking server polling response times

Describe the solution you'd like to see

.onUploadComplete(async ({ file, metadata, ctx }) => {
  await db.update(...)
  // delete old file non-blocking
  ctx.waitUntil(() => {
    utapi.deleteFile(metadata.oldFileKey)
  })
})

Additional information

No response

πŸ‘¨β€πŸ‘§β€πŸ‘¦ Contributing

  • [X] πŸ™‹β€β™‚οΈ Yes, I'd be down to file a PR implementing this feature!

juliusmarminge avatar May 10 '24 08:05 juliusmarminge

I can work in this

r0ld3x avatar Sep 11 '24 15:09 r0ld3x