-
Notifications
You must be signed in to change notification settings - Fork 829
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
workbox-background-sync: duplicate POST requests #1480
Comments
Can you try updating to Workbox v3.2.0? There were fairly significant rewrites to the background sync codebase and made with the v3 release. |
Closing due to inactivity and that this issue references an older version of |
Hi, I just found this issue because I was trying to solve the duplicate post request issue when I am using workbox-background-sync. There is a function of my web app to upload the photos. But every time I did uploaded twice to the database. Here is the code I have:
I am using workbox 3.6.1 . If I remove |
@WadeFanyao, can you take a look at the background sync API changes proposed in #1710 and see if they'd work better for your use case? |
I am facing the same issue. Any solution to this. I am using v4.3.1
workbox Using NetworkOnly to respond to 'http://xxx.xx.xxx.xxx/api/DataManagement/SyncUserData' |
@jitenderchand I am kind forgot how I did it but here is the link of my question on Stack overflow: https://stackoverflow.com/questions/52953404/duplicate-post-request-sent-by-service-worker. It may not suit for your case but it can be a reference. |
@WadeFanyao Thanks for the quick reply. I have seen this already, unfortunately, it didn't fix the issue. I need to kind of overrides the first fetch event. I have even tried with the following code but still, there are two post request const queue = new workbox.backgroundSync.Queue('myQueueName');
|
I can confirm this behavior. POST requests get added twice to the queue. I am using Workbox v4.3.1 |
Double request are made because your fetch event catch EVERY fetch request, counting the ONLINE ones also.
|
Thank you thank you @DragosRomaniuc. This has had me stumped for a long time! 👍 |
Issue description:
I'm using workbox-background-sync 2.1.3, and sometimes i'm getting duplicated requests, they are not duplicated on IndexedDB, they are just being replayed twice. There is no exact way to replicate this behavior. Workbox pushes the request to the queue, i get back online and the one and only request gets replayed twice sometimes.
Browser & Platform:
Chrome version: tested on both 65 and 66
OS: both Linux 16.04 and Windows 10 Pro
The text was updated successfully, but these errors were encountered: