-
-
Couldn't load subscription status.
- Fork 1.7k
How to use Artifact Bundles with Angular Service Worker #13449
-
Hi,
We are facing some issues when using Artifact Bundles in combination with the Angular (v17) service worker. Injecting the debugId's after the sources have been built will obviously change the hashes of the files. However, the hashes in the ngsw.json file are not updated and the service worker then fails with a hash mismatch error.
With the new application builder based on esbuild, we do not want to change the builder to the webpack builder. That leaves the options of actually injecting the debugIds later. But what is the proper approach here? Or is this an unsupported/yet to be supported scenario? Shouldn't the inject operation also update ngsw.json?
Beta Was this translation helpful? Give feedback.
All reactions
I have found a workaround. This should be mentioned in the sentry angular docs.
You can regenerate the ngsw.json after the debugIds were injected:
ngsw-config dist/apps/frontend/browser "apps/frontend/ngsw-config.json"ngsw-config should be in node_modules/.bin/
Replies: 2 comments 8 replies
-
Hmm, I think this scenario is pretty much unsupported as of now because it is a bit of a chicken and egg situation. You can use the legacy process though I believe.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hmm, I think this scenario is pretty much unsupported as of now because it is a bit of a chicken and egg situation. You can use the legacy process though I believe.
Could you elaborate on the chicken and egg problem you are seeing? The ngsw.json hashes could simply be recomputed and updated?
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes the ngsw.json could be updated but I don't really see a future where the CLI does that. It is too generic of a tool for that but maybe I am wrong. For these cases we really just kept the legacy process.
Beta Was this translation helpful? Give feedback.
All reactions
-
I have found a workaround. This should be mentioned in the sentry angular docs.
You can regenerate the ngsw.json after the debugIds were injected:
ngsw-config dist/apps/frontend/browser "apps/frontend/ngsw-config.json"ngsw-config should be in node_modules/.bin/
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
-
Hi @Lms24 , i already did that :) getsentry/sentry-docs#11494
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
Even better, thanks! ❤️ I'll take a look soon.
Beta Was this translation helpful? Give feedback.
All reactions
-
Great! Nice find. We wrote a script to update the debugIds manually, but this seems like a better solution. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks, this should definitely be mentioned in the sentry doc !!
Beta Was this translation helpful? Give feedback.
All reactions
-
@tomb it is: https://docs.sentry.io/platforms/javascript/guides/angular/troubleshooting/#invalid-hashes-in-angular-service-worker-ngswjson
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1