Nicolapps
Nicolapps2y ago

“Class extends value undefined is not a constructor or null” (Node actions + Puppeteer)

Hi everyone! I’m trying to use Puppeteer in a Node action. I have some simple code that works locally but fails when deployed on Convex:
'use node';

import puppeteer from 'puppeteer';

(async () => {
const browser = await puppeteer.launch({
headless: 'new',
});

await browser.close();
})();
'use node';

import puppeteer from 'puppeteer';

(async () => {
const browser = await puppeteer.launch({
headless: 'new',
});

await browser.close();
})();
400 Bad Request: UnableToPush: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze _deps/node/6Q45XLTZ.js: Class extends value undefined is not a constructor or null
400 Bad Request: UnableToPush: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze _deps/node/6Q45XLTZ.js: Class extends value undefined is not a constructor or null
4 Replies
ballingt
ballingt2y ago
Hi @Nicolapps! I don't know what's causing this error in particular but I would not expect puppeteer to work in a Node.js action because we bundle the code locally (just JavaScript, we don't bundle compiled code) and then deliver it and try to run in in AWS.
presley
presley2y ago
We are actively working on getting such modules to work.
Michael Rea
Michael Rea16mo ago
This would be great, attempting to use puppeteer myself but Ai controlled.
Michal Srb
Michal Srb16mo ago
Hi @Michael Rea, we have expanded the Node.js packages support significantly, check out the docs: https://docs.convex.dev/functions/bundling#external-packages
Bundling | Convex Developer Hub
Bundling is the process of gathering, optimizing and transpiling the JS/TS

Did you find this page helpful?