That is a good point - this should work, however after integrating it with Anvil like the other users have done in this thread, I also get the same errors:
The FetchEvent for "https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" resulted in a network error response: the promise was rejected.Understand this warning
OneSignalSDK.page.js:1
Failed to load resource: net::ERR_FAILED
service-worker:1
Uncaught (in promise) TypeError: Failed to fetch
at service-worker:1:48657
at Generator.next (<anonymous>)
at r (service-worker:1:47298)
at a (service-worker:1:47501)
at service-worker:1:47560
at new Promise (<anonymous>)
at service-worker:1:47441
at h (service-worker:1:48325)
at service-worker:1:49728
at Generator.next (<anonymous>)
It appears the problem is due to there being multiple service workers. Since Anvil creates a PWA, it generates a service worker as well, however that conflicts with OneSignal’s. See here
Does anyone know how to modify Anvil’s service worker in order to merge these?