getsentry / sentry-javascript-bundler-plugins

JavaScript Bundler Plugins for Sentry
https://sentry.io
BSD 3-Clause "New" or "Revised" License
143 stars 37 forks source link

`release.create` fails with error 500: duplicate key value violates unique constraint #631

Open farfromrefug opened 6 hours ago

farfromrefug commented 6 hours ago

Environment

2.22.6

i use

sentryWebpackPlugin({
                    telemetry: false,
                    org: process.env.SENTRY_ORG,
                    url: process.env.SENTRY_URL,
                    project: process.env.SENTRY_PROJECT,
                    authToken: process.env.SENTRY_AUTH_TOKEN,
                    release: {
                        name: `${appId}@${appVersion}+${buildNumber}`,
                        dist: `${buildNumber}.${platform}`,
                        setCommits: {
                            auto: true,
                            ignoreEmpty: true,
                            ignoreMissing: true
                        },
                        create: true,
                        cleanArtifacts: true
                    },
...
});

Steps to Reproduce

  1. i build my app using CI
  2. First CI build failed after the sentry webpack plugin created the new release on sentry
  3. i had to re run my CI to build the app
  4. Sentry webpack fails to create the release because the release already exists on sentry with the error 500 duplicate key value violates unique constraint (error from my sentry on premise running latest)

Expected Result

The all CI process fails because sentry webpack stops

Actual Result

I would expect the build process to still work. By that i mean that if the sentry release already exists it should still build and use the existing release. Because of that i cant run my CI unless i remove the release from sentry. I think it should work just like that. But if you prefer you could add a option like createIfNotExist or something like that

EDIT: not sure what it means for the issue on the webpack side. It is worse i cant remove the release from my sentry instance as i cant access that release on the front end (and only that release). I was on sentry 24.10.0. Trying to upgrade to 24.11.1 to see if it fixes it. For now i am stuck

chargome commented 5 hours ago

@farfromrefug could you theoretically deploy your app again using create: false in your options?

lforst commented 5 hours ago

@chargome we default create to true so that's likely not it. I asked internally whether something changed about our release creation endpoint to return failures when creating an already existing release. I don't remember this being the case.

farfromrefug commented 4 hours ago

@lforst i commented on the related sentry issue https://github.com/getsentry/sentry/issues/71655. It could be related in the sense that it could be why sentry webpack fails

EDIT: @lforst i think i know what happened and i think there is no issue on this side:

Thinking about my process i think the webpack plugin never "fail" when the release already exists. I think it just fails because of the 500 server error which is related to the release existing twice in the db. I ll leave this open until we know