i am using puppeteer in a nodejs module
$ cat package.json | jq -r '.type'
module
$ cat package.json | jq -r '.devDependencies.puppeteer'
22.11.0
i have a basic boilerplate as follows
$ cat puppeteer.config.cjs
// empty config
$ cat test.js
import puppeteer from "puppeteer";
import puppeteerConfig from "./puppeteer.config.cjs";
console.log("i am a puppet");
but i get an error upon execution
$ node src/test.js
node:internal/assert:14
throw new ERR_INTERNAL_ASSERTION(message);
^
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
at assert (node:internal/assert:14:11)
at cjsLoader (node:internal/modules/esm/translators:347:7)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:297:7)
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5) {
code: 'ERR_INTERNAL_ASSERTION'
}
Node.js v20.14.0
if i change the order of imports, the error is gone
$ cat test.js
import puppeteerConfig from "./puppeteer.config.cjs";
import puppeteer from "puppeteer";
console.log("i am a puppet");
$ node src/test.js
i am a puppet
i cannot debug further and don’t understand why this is happening and would appreciate your help.