Theo's Typesafe CultTTC
Theo's Typesafe Cult11mo ago
5 replies
agentsmith

uploadthing in vercel serverless function

Can some help out with out to do this in vercel? It works locally, but File isn't going to work in a serverless function although I did try. I'm trying to debug something and my last attempt before I tear my hair out is to upload some screenshots from puppeteer so I can see why the page state is different in this particular scenario. I just need the data format to work in a serverless function and none of my AI friends have been able to help me out.

await page.goto(targetUrl)
const screenshot = await page.screenshot({
  type: 'png',
  fullPage: true,
})
const file = new File([screenshot], `screenshot-${Date.now()}.png`, {
  type: 'image/png',
})
const uploadResult = await utapi.uploadFiles([file])


Error on vercel
error Error: File is not defined
Was this page helpful?