question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid WebSocket url in a Chrome extension context

See original GitHub issue
  • Operating System: Windows 10
  • Node Version: 12.18.2
  • NPM Version: 6.14.5
  • webpack Version: 4.44.1
  • webpack-dev-server Version: 3.11.0
  • Browser: Chrome 85.0.4183.121
  • This is a bug
  • This is a modification request

Code

Expected Behavior

Webpack dev server transportMode: 'ws' should work as expected when loaded inside a context of a Chrome extension popup.

Actual Behavior

Webpack dev server transportMode: 'ws' throws an error that the url is not valid. The problem is with this line of code

_this.client = new WebSocket(url.replace(/^http/, 'ws'));

found in WebsocketClient.js

It assumes that the protocol will be one of http:/https:, but in chrome extension popup it’s actually chrome-extension:

For Bugs; How can we reproduce the behavior?

Set the transportMode: 'ws' config to the dev server, and use it to serve a browser extension popup

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ylemkimoncommented, Feb 17, 2021

Possibly fixed in master via #2954. Could you test it?

1reaction
CPatchanecommented, Dec 1, 2020

I got it in a big project, I’ll try to reproduce it in a minimal repo 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implement websocket in chrome extension - Stack Overflow
I implemented the websockets in the background.js . Following is the code: function createWebSocketConnection ...
Read more >
chrome.webRequest - Chrome Developers
A CORS preflight for a request URL is visible to an extension if there is a ... the webRequest API supports intercepting the...
Read more >
Downloads - ChromeDriver - WebDriver for Chrome
Fixed navigation to malformed URL to return "invalid argument" error; Fixed HTTP status code when invalid session id is received; Fixed error response...
Read more >
Use case for persistent background scripts & other concerns
The implication of this is that our desktop app needs to tell our Chrome extension "hey, the device is still in range!" regularly...
Read more >
ServiceWorker is shut down every 5 minutes for manifest V3 ...
I'm affected by this issue for my private chrome extension in which I want to keep a websocket (socketio) connection alive in my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found