You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have an app that calls a api fetch call for push notifications in the service worker and it returns the follow error:
Access to fetch at 'ressource from server' from origin 'domain' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Operating System: Windows Node Version: latest web-push Version: latest
Please select any browsers that you are experiencing problems with:
Chrome
Firefox
Edge
Problem
As mentioned before, the issue is that we are getting a CORS error, but other fetch functions called by the service worker works fine. I was wondering if the vapid keys might have anything to do with it ? On top of this, I only get this issue on my deployed app using vercel and not locally. I've tried to add the following lines to my server file:
app.use((req, res, next) => {
res.setHeader("Access-Control-Allow-Origin", "*");
next();
});
but unfortunately I still get the error. Since I am not getting an error with my other fetch calls, I was wondering maybe web-push has specifics to setup or any of the sort. Any help would be appreciated!
Features Used
[ x] VAPID Support
[x ] GCM API Key
[ x] Sending with Payload
The text was updated successfully, but these errors were encountered:
Hi! Same for me. I'm encountering a CORS error on a Vercel deployment client after I added web-push logic to my Heroku socket server. I also tried to allow all domains on the client and server in the headers, but this did not work. Were you able to find a solution to the problem?
Hi, I have an app that calls a api fetch call for push notifications in the service worker and it returns the follow error:
Access to fetch at 'ressource from server' from origin 'domain' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Operating System: Windows
Node Version: latest
web-push Version: latest
Problem
As mentioned before, the issue is that we are getting a CORS error, but other fetch functions called by the service worker works fine. I was wondering if the vapid keys might have anything to do with it ? On top of this, I only get this issue on my deployed app using vercel and not locally. I've tried to add the following lines to my server file:
app.use((req, res, next) => {
res.setHeader("Access-Control-Allow-Origin", "*");
next();
});
but unfortunately I still get the error. Since I am not getting an error with my other fetch calls, I was wondering maybe web-push has specifics to setup or any of the sort. Any help would be appreciated!
Features Used
The text was updated successfully, but these errors were encountered: