Cannot get the websocket after doing a fetch to EndpointURL


This Content is from Stack Overflow. Question asked by Khai Dao

I’m trying build a customized puppeteer module for nestjs based on outdated source nest-puppeteer . It works well with with using lauch function of Puppeteer. But I would add a Debug Mode in case I would connect to other Chromnium instance. The problem is that WebSocket keep lost everytime Puppeteer fetch to EndpointURL to getWSEndpoint even through the returned result is right. Then without Websocket, it couldn’t create BrowserWSEndpoint then the error was throw out. I don’t know the reason, it does not happen with my simple Puppeteer sample. You can see two photos as belows, the first One I captured from my module and the other I capture from my simple project. The issue happe on /node_modules/puppeteer/lib/cjs/puppeteer/common/BrowserConnection.js line 96 of Puppeteer source.

My issue:
enter image description here

It should be like this:
enter image description here

You can download the my source code is here. I already setup a test for this case. you just run “npm test”

You could lauch a chromenium instance by run “node lauchBrowserInstance.js” from my sample repo.


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?