Next.js Discord

Discord Forum

Infamous Vercel playwright scraping serverless function limit of 50MB

Unanswered
Grass carp posted this in #help-forum
Open in Discord
Grass carpOP
I have a next.JS / Typescript application which scrapes data via Next APIs (serverless functions). Problem is I can't build and deploy on Vercel because the serverlessfunction exceeds 50MB (about 52.5MB currentlyà
I have tried moving the browser initialization to another non-API file to reduce the size, went back to JS, do dynamic imports, nothing works...
The only """solution""" I found is to put the /pages/api folder into just /api at the root, but obviously this breaks more stuff than it fixes.

My page import look like this:

import cheerio from "cheerio";
import { launchChromium } from "playwright-aws-lambda";

My dependencies corresponding to the API are :
"playwright-aws-lambda": "0.10.0",
"cheerio": "^1.0.0-rc.12",

Should I find a way to downgrade or change my dependencies? It did work at some point (about 1 month ago) and I'm not sure what changed. Also, would the pro version maybe increase this limit as a last resort?

0 Replies