Nicolapps
Nicolapps
CCConvex Community
Created by Nicolapps on 9/7/2023 in #support-community
“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
5 replies
CCConvex Community
Created by Nicolapps on 8/29/2023 in #support-community
Access fetch’s Response.redirected in Convex runtime actions
This currently throws:
import { internalAction } from "./_generated/server";

export default internalAction(async ({ runMutation }) => {
const src = 'https://www.convex.dev/ai-town/';
const res = await fetch(src);
console.log(res.redirected);
});
import { internalAction } from "./_generated/server";

export default internalAction(async ({ runMutation }) => {
const src = 'https://www.convex.dev/ai-town/';
const res = await fetch(src);
console.log(res.redirected);
});
failure
Not implemented: get redirected for Response. Consider calling an action defined in Node.js instead (https://docs.convex.dev/functions/actions).
at <anonymous> (../convex/action_aitown.ts:6:1)
failure
Not implemented: get redirected for Response. Consider calling an action defined in Node.js instead (https://docs.convex.dev/functions/actions).
at <anonymous> (../convex/action_aitown.ts:6:1)
Even though I can use "use node" to make it work, it would be neat to make this work in the Convex runtime.
1 replies