Closed
Description
Describe the bug
I created a brand new app using:
npx create-react-app my-app
When I run the build adding NOTHING, I see this error:
SecurityError: The operation is insecure.
Did you try recovering your dependencies?
N/A
Which terms did you search for in User Guide?
I looked at the troubleshooting guide. None of the information is applicable.
Environment
Heroku
Steps to reproduce
- npx create-react-app my-app
- push the app to a github account
- deploy that repo to Heroku
Expected behavior
The app should run
Actual behavior
Reproducible demo
https://cra-fails.herokuapp.com/
I think it may be related to this issue:
It looks like if I use react-scripts 3.2.0 it doesn't break. I am thinking based upon the issue published above it is the lines in webpackHotDevClient.js that changed from:
// Connect to WebpackDevServer via a socket.
var connection = new SockJS(
url.format({
protocol: window.location.protocol,
hostname: window.location.hostname,
port: window.location.port,
// Hardcoded in WebpackDevServer
pathname: '/sockjs-node',
})
);
to:
// Connect to WebpackDevServer via a socket.
var connection = new WebSocket(
url.format({
protocol: 'ws',
hostname: window.location.hostname,
port: window.location.port,
// Hardcoded in WebpackDevServer
pathname: '/sockjs-node',
})
);
You'll notice that the app loads if the protocol is http vs https:
http://cra-fails.herokuapp.com/
I think the protocol is messing it up.