Is there an existing issue for this?
Is this a problem caused by your code, or is it specifically because of the library?
Describe the bug.
Production application randomly crashes with Attempted to use detached Frame error during isRegisteredUser() and getNumberId() or sendMessage () calls after approximately 1-2 hour of runtime. The error occurs unpredictably and requires a full PM2 restart to resolve temporarily.
i have 9 sessions using the
const SESSIONS = path.resolve('sessions');
authStrategy: new LocalAuth({ clientId: ID, dataPath: SESSIONS }),
Error Stack Trace
Error: Attempted to use detached Frame '28F5ADBA4934BB56D3595F5F0C2600EA'.
at CdpFrame. (/node_modules/puppeteer-core/lib/cjs/puppeteer/util/decorators.js:107:23)
at CdpPage.evaluate (/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:826:43)
at Client.getNumberId (/node_modules/whatsapp-web.js/src/Client.js:1627:35)
at Client.isRegisteredUser (/node_modules/whatsapp-web.js/src/Client.js:1613:35)
at file:///home/bm/whatsapp-bot/public_html/core.js:374:39
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
the create client code is
const client = new Client({
authStrategy: new LocalAuth({ clientId: userId, dataPath: SESSIONS }),
puppeteer: {
headless: 'new',
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-gpu',
// Frame stability
'--disable-features=IsolateOrigins,site-per-process',
'--disable-site-isolation-trials',
// Memory management
'--js-flags=--max-old-space-size=512',
'--renderer-process-limit=2',
// Performance
'--disable-extensions',
'--disable-software-rasterizer',
'--mute-audio'
]
},
});
the send message code :
// ERROR OCCURS HERE and if commented it it will OCCURS at sendMessage()
const isRegistered = await client.isRegisteredUser(req.body.phone);
if (!isRegistered) {
return res.status(400).json({
error: 'not_whatsapp',
message: 'The given phone number is not registered on WhatsApp.'
});
}
try {
const to = req.body.phone.includes('@c.us')
? req.body.phone
: `${req.body.phone}@c.us`;
await client.sendMessage(to, req.body.message);
}
Expected Behavior
a long term run without exceptions
Steps to Reproduce the Bug or Issue
Initialize WhatsApp client with LocalAuth strategy
Wait for client to reach 'CONNECTED' state
Handle incoming messages and send messages normally
After ~1 hour of runtime (varies), call client.isRegisteredUser(phoneNumber)
Error occurs during the getNumberId() evaluation
Frequency: Occurs randomly after 1-3 hours of uptime
WhatsApp Account Type
Standard
Browser Type
Puppeteer version: 24.35.0 with Chrome/143.0.7499.192
Operation System Type
Ubuntu (VPS)
Phone OS Type
i can't know but most are android
WhatsApp-Web.js Version
1.34.4
WhatsApp Web Version
2.3000.1032134509
Node.js Version
v21.7.3
Authentication Strategy
LocalAuth
Additional Context
Running in production with PM2 process manager
Managing multiple concurrent WhatsApp sessions (6+ clients)
Error affects all sessions eventually, not just specific ones
Sessions remain "CONNECTED" according to client.getState() even when frame errors occur
Is there an existing issue for this?
Is this a problem caused by your code, or is it specifically because of the library?
Describe the bug.
Production application randomly crashes with Attempted to use detached Frame error during isRegisteredUser() and getNumberId() or sendMessage () calls after approximately 1-2 hour of runtime. The error occurs unpredictably and requires a full PM2 restart to resolve temporarily.
i have 9 sessions using the
const SESSIONS = path.resolve('sessions');
authStrategy: new LocalAuth({ clientId: ID, dataPath: SESSIONS }),
Error Stack Trace
Error: Attempted to use detached Frame '28F5ADBA4934BB56D3595F5F0C2600EA'.
at CdpFrame. (/node_modules/puppeteer-core/lib/cjs/puppeteer/util/decorators.js:107:23)
at CdpPage.evaluate (/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:826:43)
at Client.getNumberId (/node_modules/whatsapp-web.js/src/Client.js:1627:35)
at Client.isRegisteredUser (/node_modules/whatsapp-web.js/src/Client.js:1613:35)
at file:///home/bm/whatsapp-bot/public_html/core.js:374:39
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
the create client code is
the send message code :
Expected Behavior
a long term run without exceptions
Steps to Reproduce the Bug or Issue
Initialize WhatsApp client with LocalAuth strategy
Wait for client to reach 'CONNECTED' state
Handle incoming messages and send messages normally
After ~1 hour of runtime (varies), call client.isRegisteredUser(phoneNumber)
Error occurs during the getNumberId() evaluation
Frequency: Occurs randomly after 1-3 hours of uptime
WhatsApp Account Type
Standard
Browser Type
Puppeteer version: 24.35.0 with Chrome/143.0.7499.192
Operation System Type
Ubuntu (VPS)
Phone OS Type
i can't know but most are android
WhatsApp-Web.js Version
1.34.4
WhatsApp Web Version
2.3000.1032134509
Node.js Version
v21.7.3
Authentication Strategy
LocalAuth
Additional Context
Running in production with PM2 process manager
Managing multiple concurrent WhatsApp sessions (6+ clients)
Error affects all sessions eventually, not just specific ones
Sessions remain "CONNECTED" according to client.getState() even when frame errors occur