deno-puppeteer icon indicating copy to clipboard operation
deno-puppeteer copied to clipboard

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

Open kimdah3 opened this issue 1 year ago • 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?

kimdah3 avatar Apr 14 '23 12:04 kimdah3

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

waptik avatar May 18 '23 22:05 waptik

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.

kimdah3 avatar May 27 '23 18:05 kimdah3