Azure Kubernetes - Puppeteer preparing PDF Error: Page crashed! at Page._onTargetCrashed

9/19/2019

When program runs await page.evaluate(...);, there is error throwing out:

Error: Page crashed!
    at Page._onTargetCrashed (/usr/src/app/node_modules/puppeteer/lib/Page.js:170:24)
    at CDPSession.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/Page.js:125:56)
    at CDPSession.emit (events.js:203:13)
    at CDPSession._onMessage (/usr/src/app/node_modules/puppeteer/lib/Connection.js:200:12)
    at Connection._onMessage (/usr/src/app/node_modules/puppeteer/lib/Connection.js:112:17)
    at WebSocket.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/WebSocketTransport.js:41:24)
    at WebSocket.onMessage (/usr/src/app/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:203:13)
    at Receiver.receiverOnMessage (/usr/src/app/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:203:13)
[2019-09-19T02:59:56.202Z] Error for printPdf()
Error: Protocol error (Runtime.callFunctionOn): Target closed.
    at /usr/src/app/node_modules/puppeteer/lib/Connection.js:183:56
    at new Promise (<anonymous>)
    at CDPSession.send (/usr/src/app/node_modules/puppeteer/lib/Connection.js:182:12)
    at ExecutionContext.evaluateHandle (/usr/src/app/node_modules/puppeteer/lib/ExecutionContext.js:106:44)
    at ExecutionContext.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:111:23)
    at ExecutionContext.evaluate (/usr/src/app/node_modules/puppeteer/lib/ExecutionContext.js:48:31)
    at ExecutionContext.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:111:23)
    at DOMWorld.evaluate (/usr/src/app/node_modules/puppeteer/lib/DOMWorld.js:112:20)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
  -- ASYNC --
    at Frame.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:110:27)
    at Page.evaluate (/usr/src/app/node_modules/puppeteer/lib/Page.js:782:43)
    at Page.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/helper.js:111:23)
    at printPdf (/usr/src/app/puppeteer.js:219:16)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
    at async /usr/src/app/puppeteer.js:133:21 {
  message: 'Protocol error (Runtime.callFunctionOn): Target closed.'
}

I tried to increase Azure Kubernetes VM size to have better CPU and Memory, it worked and problem was gone. However, it happened suddenly again and I don't want to upgrade VM size to EXTREMELY model.

How to solve it completely?


Further adding htop screen capture for reference:
(It was not reaching to 80% yet) enter image description here

-- DaiKeung
azure-kubernetes
kubernetes
puppeteer

0 Answers