-
Notifications
You must be signed in to change notification settings - Fork 158
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
Failed to load Stripe.js #26
Comments
This error is raised if the script failed to load (e.g. network error), or loaded but didn't execute properly (didn't register Do you have any CSP that might interfere with loading of the Stripe.js script? Maybe those customers have extensions installed blocking some 3rd party scripts? Do you have metrics on how often this happens? Are most Firefox users able to load without errors? Unless you can gather more details from an impacted user, I'm not sure we'd be able to track down the cause. |
It happened around 370 times to about 180 different users in 7 days. I will try to load stripe script only when required and use I'm suspecting extenstions too though :/ |
I'm having an issue which might be related, but I'm not getting any Stripe-related errors in Sentry. I'm just getting a lot of reports of customers not being able to type anything in the box, which suggests something is breaking when Stripe is loading. |
@vincentaudebert unfortunately an absolute number doesn't really tell me much about the frequency of this problem compared to successful loads. However that is a fairly high number. It would be great to see if you can find a correlation between them. I'd still recommend you keep using |
@AndrewIngram, without any more information it's hard to tell. |
@hofman-stripe I reckon a different error message would be a very good first step. We have about 2k users / day in average. So it's a small proportion but totally flooding our Sentry :( |
I'm curious, would you be able to figure out if for any of the impacted users, they've ever had a successful load of Stripe.js? I'm wondering if some browsers may not implement |
Also to avoid sentry spam, I'd recommend handling the rejection of |
@hofman-stripe According to our Sentry it looks like it's going through the error listener and not the load one. |
@hofman-stripe FYI, I got rid of Sorry I don't have more info to help you :/ |
Are you still listening to load errors for the injected script tag? |
Good point, I'll add an error event listener. Also do you think it could be possible to add an option to avoid loading js.stripe.com/v3 on every page when importing the package? |
We inject the script on every page for fraud detection, as mentioned in the Readme here and in the documentation. However I realize now that the unhandled rejection will be triggered even when you don't call |
On my side, I'm about to push live a better error management. I'll keep you posted if I see something odd/interesting. Cheers. |
@vincentaudebert, we've released v1.3.0 which should no longer cause unhandled rejections. It won't solve the root cause of what might be causing the load errors, because those are most likely due to the user's environment. I will close this issue, but please let us know if you discover more data on what might be causing the load errors. |
@hofman-stripe looks like we could have a good guilty extension here: It matches a bit our data by the fact that it looks like we get most of the exceptions on Firefox. And there is this extension on Chrome but it's far less popular? Nothing sure but I would probably bet on that. PS: I'll try it when I have some spare time |
I'm seeing a large number of these errors but all on iOS / macOS safari 13.0.5 |
@esetnik, can you clarify? Are you getting a Do you have successful loads on those browsers? What percentage of failures do you see? Is there any other common properties in those failures besides the browser type? I know Safari has sometimes some strange behavior when it comes to caching, but I haven't seen those happen on the script load. |
@hofman-stripe I confirm that firefox noscript addon definitely causes the loading error. Additionally, same happens with EFF Privacy Badger. While it's obvious those addons do that, many users today seem to install them without understanding the repercussions. I got this report from a client who had no clue those could render some sites unusable. I suspect there are many such users out there. |
Not sure if related, but I'm using Also, I'm using Angular and importing the js file in my main index file like the docs explain (without adding this it always fails). Docs say you should include like this <script src="https://js.stripe.com/v3" async></script> but what fixed it for me was removing async like this <script src="https://js.stripe.com/v3"></script> Looks like there might be a race condition somewhere but removing the async will load the library and start executing ASAP, this is also the first line in my I'm not a JS expert, but I'd be happy to provide more info if you think that would help, @hofman-stripe |
That sounds like a different issue. Seems like the module isn't able to reach the DOM to find or inject the script tag. You wouldn't be able to share a reproduction by any chance? |
And right you are, my <meta http-equiv="Content-Security-Policy"
content=" script-src 'self' https://js.stripe.com/v3"> |
Ha yeah CSP needs to allow Please see the Content Security Policy section of the security guide. |
FYI, we had a similar thing and the problem was solved by editing |
@vincentaudebert I got the same issue. It's because Stripe will be loaded whenever
That's why your pages still load Stripe regarless you tried to call To solve the issue, there are 2 steps
Useful tutorial: https://dev.to/stripe/importing-stripe-js-as-an-es-module-1ni |
@huonghk I don't see why defer loading the script would allow it to successfully load, but loading it early would fail. Defer loading Stripe.js has negative implications for fraud detection and is not recommended. |
just realised the error is try..catch-able at the await portion of the code even if we are globally loading it (instead of defering loading) and this is very good to know! so in cosole you can see the network error (and in code it's still catchable when you await that promise!) |
For anyone who may still be coming across this error, we were mystified by this ourselves, and witnessing it only affecting Safari and Mobile Safari users. It turns out the errors were not adversely affecting our users at all — what was happening was, we use auth0 for our identity provider, and lean on the cc @hofman-stripe, this may be of interest to you. |
I am running into this issue on localhost and heroku with firefox 86.0. Chrome, Edge are working fine. This is not negatively impacting the redirect to the check-out page. It is just a console error that is annoying. |
And how do we fix this particular issue? |
Running into this issue recently, so far only in Chrome on Win10. |
Same i am facing this issue on chrome and win10. |
I found a way to reproduce this problem in dev: First, make sure you load Stripe using the import { loadStripe } from '@stripe/stripe-js/pure';
const stripePromise = (async () => {
for (;;) {
try {
// This sleep here makes it easier to reproduce locally, we're delaying the loading of Stripe
await new Promise((r) => setTimeout(r, 20000));
return await loadStripe('API_KEY');
} catch (err) {
console.error(err);
await new Promise((r) => setTimeout(r, 5000));
}
}
})(); Now to reproduce:
This means retry doesn't work and once you have received the error const stripePromise = (async () => {
try {
return await loadStripe('API_KEY');
} catch (err) {
console.error(err);
window.location.reload();
}
})(); I see this happening a lot in the wild in production environments, so it's not just in dev. I definitely think this is a bug in Stripe.js and should be fixed, as I think it will lead to horrible UX, as it will make the Stripe Elements hang forever when the customer wants to pay... |
Why is this issue closed when there are many people experiencing the same problem? @hofman-stripe |
How about this one
It doesn't load the iframe always. It will only load when the |
I can't believe there's still no fix for this, it's the most common error we have in Sentry. Reloading entire page sounds like a UX nightmare 😬 |
I think someone just needs to open a new issue. Maybe the Stripe team doesn't read closed issues |
Also seeing this... |
Hey folks, I/we have been keeping an eye on this as more examples roll in. While this is currently expected behaviour (not a bug), it's also not ideal. @mifi 's clear repro/example earlier this year prompted me to press the team to see about improving this. As you can see in the above-linked PR, we're working on revising this to allow for programmatic retries without getting the cached failure. |
Getting lots of these too. |
Still seeing this error as well |
@esetnik If you're seeing a consistent errors related to loading Stripe.js with this package, please open a new issue and share details such as:
|
Still experiencing this with this tech stack: React v18 Over 130 events of this in the last 30 days. Luckily our dashboard isn't used to heavily, but it's still annoying for our oncall rotation. Luckily I found this thread, so I'll link it to our Jira ticket(s) so we can monitor the situation. |
Just thought I would drop this in here. We have been dealing with blasts of this error in our Sentry logs a couple times a week for the last month or so. After looking at Cloudflare logs, we are pretty sure its actually coming from Microsoft's cloud...probably Outlook.com prefetching images from our site for emails (we do email marketing for experiences and our site is a marketplace with images for each event). So, basically Azurebots are loading pages but Stripe.js fails to load in their environment. This sucks because its a ton of noise that masks legitimate Stripe loading errors...but just thought I would drop this in there in case others are dealing with the same thing. |
Hi @mswezey23 @bennybrau. If Stripe.js fails to load, the error message is expected. Managing error messages is an integration question, and we aren’t able to answer those here on GitHub. Please reach out to Stripe Support for help with integration issues. |
Since Stripe isn't interested in implementing this feature or documenting ways to manage it, and it's clearly a common enough problem that this issue continues to get traffic, someone else wrote a solution that may work for you: https://github.com/wobsoriano/retry-stripe-loader |
a fix was already implemented in #518 - afaik you can now call |
Summary
Some of my users are getting an error thrown
Failed to load Stripe.js
Sadly, I can't reproduce and I don't have more details. My page is working perfectly fine for me and some of my colleagues.
I have
js.stripe.com/v3
loaded in my head tagAnd
loadStripe
is correctly executed only once.Here is my code:
And then later:
Other information
According to sentry report, it looks like it's happening only on Firefox.
Thanks for your help.
The text was updated successfully, but these errors were encountered: