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
Cross-Origin-Resource-Policy header Error on Paypal Checkout #255
Comments
Hey, could you tell me which version of Nuxt Security are you using? 0.14.4 or 1.0.0-rc.2? |
Interestingly, I am receiving a different error after trying your example:
And I managed to resolve that by setting the Cross-Origin-Embedder-Policy to unsafe none for certain route: export default defineNuxtConfig({
modules: ['nuxt-security'],
routeRules: {
'/test': {
headers: {
'Cross-Origin-Embedder-Policy': 'unsafe-none'
}
}
}
}) This solved the issue on my side. If this wont help, please provide maybe a reproduction repo so that I could test it out as I cant reproduce the exact issue :) |
Thanks for quick response Kindly follow https://stackblitz.com/edit/nuxt-starter-qyhpuh?file=pages%2Findex.vue,pages%2Fpayment.vue,app.vue,nuxt.config.ts |
Hey, Thanks for the reproduction. It seems that Firefox is throwing different errors than Chrome indeed. This is something that is really difficult to handle from the package side. But you should be able to solve it in your application by using the following code: export default defineNuxtConfig({
modules: ['nuxt-security'],
routeRules: {
'/payment': {
headers: {
'Cross-Origin-Embedder-Policy': 'unsafe-none',
'Cross-Origin-Resource-Policy': 'cross-origin'
}
}
}
}) The above solution should fix both Chrome and Firefox issues for you embedding the Paypal checkout :) |
Have you tested it on reproduction code? I think its still throwing the error on both browser. |
I have tested it locally with these headers. Keep in mind that Stackblitz does not work perfectly well with Security headers so maybe isn't working because of that. Have you tried it in your app? |
Hi @geekyshow1 such as:
|
I got that same error in another website with Matomo, and solved that with |
Any more details about your issue? |
I am not able to use Nuxt Security becoz i do not have way to add crossorigin when using Paypal module loadScript(). I also dont know whether @vejja suggestion will resolve the issue or not. I just wanted to give it a try. I don't think paypal will address this issue. I can't ignore any of these two module neither nuxt security nor paypal pg. So i will keep looking for a solution until the project deadline. If you guys come up with a solution please post it here as non of the above solution worked. |
Just looked at the PayPal code quickly and I think you could use loadCustomScript() instead of loadScript(). But you’ll have to write additional JS code. Did you try the |
Yes it does resolve the issue however it requires below setting as well
I am also sharing useHead this may help someone else
I think i should close this issue as you guys are not responsible to maintain or modify paypal module. |
Great to know it works for you now ! |
Great to hear! If you dont mind, I would like to add your code sample to the FAQ section of the documentation so that future users will have a solution right away :) |
Yes please go ahead It's my honor if it could help other. |
I am closing this issue if someone need help regarding loadScript crossorigin kindly follow Paypal Module issue paypal/paypal-js#434 |
Hi, i am adding Paypal Checkout Button on a Nuxt Project. Following Official Paypal Documentation https://developer.paypal.com/sdk/js/configuration/#link-addthesdk
In this document There are two ways to add checkout button:-
1. Using Script Tag
1.1 Add Script Tag
1.2 Add a div where the Button will render
2. Using Module
2.1 Install Module https://www.npmjs.com/package/@paypal/paypal-js
2.2 Write below code
2.3 Add a div where the Button will render
Everything works fine until i install Nuxt Security
No matter which method i use to add Paypal whether it Script or module it throws error on console as below
When i disable or uninstall nuxt security it started to work again. I greatly appreciate your help.
The text was updated successfully, but these errors were encountered: