ChromeDevTools / debugger-protocol-viewer

DevTools Protocol API docs—its domains, methods, and events
https://chromedevtools.github.io/devtools-protocol/
Other
860 stars 173 forks source link

Protocol errors when connecting on Debian via Puppeteer #88

Closed chrbala closed 6 years ago

chrbala commented 6 years ago

I'm not exactly sure that this is a debugger-protocol-viewer error, but I thought I'd start here because I'm getting protocol errors.

What steps will reproduce the problem?

  1. Start up a Chrome headless instance without seccomp (see below for Docker images)
  2. Get websocket link with the /json endpoint.
  3. Connect to Chrome instance in Node via Puppeteer@0.12.0

What is the expected result?

The connection is successfully made.

What happens instead of that?

When using justinribeiro/chrome-headless, I get the following error:

Protocol error (Performance.enable): 'Performance.enable' wasn't found undefined

      at Session._onMessage (../../node_modules/puppeteer/node6/Connection.js:272:25)
      at Connection.<anonymous> (../../node_modules/puppeteer/node6/Connection.js:150:19)
      at next (native)
      at step (../../node_modules/puppeteer/node6/Connection.js:113:24)
      at Promise (../../node_modules/puppeteer/node6/Connection.js:131:12)
      at fn (../../node_modules/puppeteer/node6/Connection.js:109:10)
      at Connection._onMessage (../../node_modules/puppeteer/node6/Connection.js:133:3)
      at emitOne (events.js:96:13)
      at WebSocket.emit (events.js:188:7)
      at Receiver._receiver.onmessage (../../node_modules/ws/lib/WebSocket.js:143:47)
      at Receiver.dataMessage (../../node_modules/ws/lib/Receiver.js:389:14)
      at Receiver.getData (../../node_modules/ws/lib/Receiver.js:330:12)
      at Receiver.startLoop (../../node_modules/ws/lib/Receiver.js:165:16)
      at Receiver.add (../../node_modules/ws/lib/Receiver.js:139:10)
      at Socket._ultron.on (../../node_modules/ws/lib/WebSocket.js:139:22)
      at emitOne (events.js:96:13)
      at Socket.emit (events.js:188:7)
      at readableAddChunk (_stream_readable.js:176:18)
      at Socket.Readable.push (_stream_readable.js:134:10)
      at TCP.onread (net.js:547:20)

I thought it might be from the month-old Chrome version in the build, so I tried again with my own fresh container, chrbala/headless-chrome which uses the same dockerfile and was built with Chromium 62.0.3202.62-1. The version of Puppeteer I'm using declares that it's compatible with chromium_revision of 508693, but I'm not sure how that maps to the semantic Chromium versions.

My build had a different error:

Protocol error (Runtime.callFunctionOn): Invalid parameters objectId: string value expected

      at Session._onMessage (../../node_modules/puppeteer/node6/Connection.js:272:25)
      at Connection.<anonymous> (../../node_modules/puppeteer/node6/Connection.js:150:19)
      at next (native)
      at step (../../node_modules/puppeteer/node6/Connection.js:113:24)
      at Promise (../../node_modules/puppeteer/node6/Connection.js:131:12)
      at fn (../../node_modules/puppeteer/node6/Connection.js:109:10)
      at Connection._onMessage (../../node_modules/puppeteer/node6/Connection.js:133:3)
      at emitOne (events.js:96:13)
      at WebSocket.emit (events.js:188:7)
      at Receiver._receiver.onmessage (../../node_modules/ws/lib/WebSocket.js:143:47)
      at Receiver.dataMessage (../../node_modules/ws/lib/Receiver.js:389:14)
      at Receiver.getData (../../node_modules/ws/lib/Receiver.js:330:12)
      at Receiver.startLoop (../../node_modules/ws/lib/Receiver.js:165:16)
      at Receiver.add (../../node_modules/ws/lib/Receiver.js:139:10)
      at Socket._ultron.on (../../node_modules/ws/lib/WebSocket.js:139:22)
      at emitOne (events.js:96:13)
      at Socket.emit (events.js:188:7)
      at readableAddChunk (_stream_readable.js:176:18)
      at Socket.Readable.push (_stream_readable.js:134:10)
      at TCP.onread (net.js:547:20)

Both of the above Docker images were built with this docker file.

paulirish commented 6 years ago

the Performance domain was added on 2017-08-10 so whatever Chromium is in that docker build is older than that.

Pptr doesn't run against any version of chrome, so that's the problem. you'll need to get the chromium version updated to 63.

see the NOTE here: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions

paulirish commented 6 years ago

Also.. appreciate you trying to place this issue in the right place, but it's a puppeteer issue so it'd best belong to that repo. ;)

chrbala commented 6 years ago

Actually, it seems that I just had to use google-chrome-unstable for the functionality that puppeteer needed - thanks!