Closed taobojlen closed 2 months ago
It is strongly recommended to run the plugin exactly when the prod build is running to avoid source maps to be drifting apart between builds.
I still don't understand your setup. Do you deploy the same app multiple times? And do you point each deployment to a separate project in Sentry? If so, we don't support sharing artifacts between projects yet, meaning you have to upload them multiple times.
@lforst yes, we deploy our app many times -- we have an environment for each of our customers. they all live in the same sentry project, but as different environments.
so the deployed code will be the same across environments. we want a way to tell sentry "hey, environments A and B were just updated to run version X of our app, so that's the sourcemap to use".
maybe this isn't actually necessary? if we upload the sourcemap once, and create releases via the sentry CLI or github integration, will that work?
Currently, you need to upload sourcemaps to each project separately.
I have the same problem, I have a Vite application with two environments (staging and production). And the code base is not the same (I have new features on staging that I don't have in production yet). I use sentry vite plugin in the deployment CIs to upload the sourcemaps. But how can I upload different sourcemaps in the same Sentry project but in two different Sentry environments (staging and production) ?
@bastien-pruvost I don't think your problem is the same. You are not uploading to two different projects. If you use the default configuration of the vite plugin, everything should just work for you.
@lforst I don't upload to different Sentry projects either! I just have one project, with multiple environments.
My understanding is that the hierarchy in Sentry goes like this: Project -> Environment -> Release -> Sourcemap.
So my overall question is: when we deploy the same build to n environments, do we need to upload n sourcemaps? Or is it possible to upload a single sourcemap, and create the releases separately (e.g. via Sentry's API)? Is Sentry smart enough to re-use the sourcemap across environments in that case?
The hierarchy goes:
So if you have multiple environments that all send to the same project in Sentry, everything should just work fine by uploading once, everytime you build your application.
I am facing the same problem with a similar setup. My issue is that I have 2 self-hosted Sentry instances (one for development and one for production) but I only run the build once, so the upload only happens to one instance. because of our deployment strategy I can not do another build. So I need to find a way to upload the source maps in the build step twice to 2 different Sentry urls. My guess is that I need to use a custom script to upload the source maps or am I missing something?
@dsteinel I think you could add the plugin twice. I have never tried that out though. Two self-hosted instances is definitely not a pattern we optimize for.
Ah yes that actually works! Thanks a lot @lforst
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
We're using
@sentry/vite-plugin
to create releases & upload sourcemaps to Sentry. We have a lot of environments, so this is what our flow looks like:vite build
without the Sentry pluginvite build
again in a post-deploy step, this time with the Sentry plugin configured so it creates the Sentry release w. sourcemaps for that environment.This is quite inefficient, since we have to build our frontend N+1 times for N environments. Ideally, there would be a way to upload sourcemaps for many environments at once when we build.
Alternatively, if we're using the plugin incorrectly, I'd love to hear it! But I imagine that this is not an uncommon setup.