I am running the API in a Docker container using the following base image:
FROM zenika/alpine-chrome:with-puppeteer
On my local machine, the API code runs perfectly. However, when I run it inside the Docker container, I get the following error:
/api/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221
throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
^
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')
at puppeteer_evaluation_script:5:95
at ExecutionContext._evaluateInternal (/api/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ExecutionContext.evaluate (/api/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.initialize (/api/node_modules/whatsapp-web.js/src/Client.js:323:9)
Node.js v20.12.1
I followed these steps:
https://github.com/pedroslopez/whatsapp-web.js/pull/2816#issuecomment-2204732956