-
Notifications
You must be signed in to change notification settings - Fork 645
Show error message when JS code fails to load #3044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I've added a hash of the inline script to the CSP config for nginx, deployed it to staging, and it appears to work :) |
450c614
to
a72df88
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me locally in Firefox and Chrome when I block the vendor-*.js
resource, but this does not work (i.e. blank page only) if I block cargo-*.js
.
Additionally, in Firefox only, I see the error None of the “sha512” hashes in the integrity attribute match the content of the subresource.
in my console. This is confusing because I don't have CSP enabled in my local environment, and the error seems to be referring to Subresource Integrity. Otherwise the behavior between Chrome and Firefox appears the same, so this may be unrelated.
I don't understand why this appears to rely on cargo.js loading.
My test setup is to run ember build --prod
followed by cargo run --bin server
and then accessing via http://localhost:8888
. This is similar to our production enviornment, sans nginx configuration (like CORS).
I've managed to reproduce your issue and I think I understand what's going on: At least in Chrome, it looks like blocking a URL through the devtools does not cause the In other words: blocking the URL through the devtools does not seem to create a realistic failure scenario. The thing we want to test here is having a syntax error in the JS file, so what I did to test this is prefix the content of one of the JS files with e.g. an |
Well it sounds like my test steps were fatally flawed then. Thanks for investigating further and adding the comment. @bors r+ |
📌 Commit d425ab5 has been approved by |
☀️ Test successful - checks-actions |
This should resolve #2984, by adding a short error message when something fails to load before the Ember app has booted up:
This does use an inline script though, so we might have to adjust the CSP for this 😞
r? @jtgeibel