Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to use Artifact Bundles with Angular Service Worker #13449

Answered by lennybakkalian
maxhov asked this question in Q&A
Discussion options

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?

You must be logged in to vote

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

Comment options

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.

You must be logged in to vote
2 replies
Comment options

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?

Comment options

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.

Comment options

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/

You must be logged in to vote
6 replies
Comment options

Hi @Lms24 , i already did that :) getsentry/sentry-docs#11494

Comment options

Lms24 Oct 7, 2024
Maintainer

Even better, thanks! ❤️ I'll take a look soon.

Comment options

Great! Nice find. We wrote a script to update the debugIds manually, but this seems like a better solution. Thanks.

Comment options

Thanks, this should definitely be mentioned in the sentry doc !!

Comment options

Answer selected by maxhov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /