lucacasonato/deno-puppeteer

Question: why is browser.close() crasching when using browserless.io

Opened this issue · 2 comments

Using https://github.com/guifromrio/puppeteer_on_deploy/blob/main/main.tsx crasches the app when closing.

error: Uncaught ErrorEvent {
  bubbles: false,
  cancelable: false,
  composed: false,
  currentTarget: null,
  defaultPrevented: false,
  eventPhase: 0,
  srcElement: null,
  target: WebSocket {
  url: "wss://chrome.browserless.io/?token=BROWSERLESS_TOKEN",
  readyState: 3,
  extensions: "",
  protocol: "",
  binaryType: "blob",
  bufferedAmount: 0
},
  returnValue: true,
  timeStamp: 1681473331975,
  type: "error",
  message: "WebSocket protocol error: Connection reset without closing handshake",
  filename: "",
  lineno: 0,
  colno: 0,
  error: undefined
}

Any idea on why, maybe it's a browserless.io thing?

consider trying https://github.com/waptik/puppeteer_on_deploy. Demo at https://fresh-screenshot.deno.dev

Got the same error along with
IO error: An established connection was aborted by the software in your host machine
I tried running on ubuntu 22 and it worked but not on my linux instance running at fly.io.

So as a work around I configure the timeout inside the socket url and I used that as a way of closing my browser instance by manually waiting for it to timeout. Not ideal but it doesn't crash the whole app.