sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Too many deployments created with Next.js

Open IGassmann opened this issue 2 years ago • 3 comments

Environment

What version are you running? Etc.

@sentry/nextjs: 7.12.1

Steps to Reproduce

  1. Set up a Next.js project with Sentry (you can use Next.js' example)
  2. Enable Vercel + Sentry integration
  3. Update next.config.js as this file
  4. Add .env file with the following values (don't forget to update the values with yours):
VERCEL="1"
VERCEL_ENV="development"
SENTRY_AUTH_TOKEN="your-auth-token"
NEXT_PUBLIC_SENTRY_DSN="your-dsn"
SENTRY_PROJECT="your-project"
SENTRY_ORG="your-org"
  1. Run yarn build

Expected Result

Only one deployment should show up on the Sentry release page.

Actual Result

In total 3 deployments are created by the webpack plugin for each time the project builds on Vercel. There should be only one. This results in people being notified by email 3 times each time there's a new release.

CleanShot 2022-09-02 at 15 48 24@2x

P.S.: Is there any reason why deployments are not enabled by default by @sentry/nextjs? It was hard to find why releases are not tagged with an environment.

IGassmann avatar Sep 02 '22 13:09 IGassmann

Setting runOnce to true solves the issue, but then not all source maps are uploaded to Sentry.

BTW the runOnce property is not documented on the project's REAMD.md file.

IGassmann avatar Sep 02 '22 13:09 IGassmann

Huh. Three is surprising to me. Two would make sense (one for backend, one for frontend), but off the top of my head I can't think where the third would be coming from. Can you please post a link to the page you took the screenshot from?

That said, whether it's three or two, you're right that we could be smarter about this. I'm going to move this issue to the SDK repo and put fixing that in our backlog.

In the meantime, though, I'll answer your question with one of my own: What's your use-case which needs deploys over and above releases? As you point out, they should have a one-to-one relationship (which is precisely why we don't enable them by default).

lobsterkatie avatar Sep 16 '22 18:09 lobsterkatie

@lobsterkatie, here's the link to that page: https://sentry.io/organizations/igor-gassmann-temporary/releases/aeef930315afb20193e8d1f646b13f455adef0c6/?project=6712309

What's you use-case which needs deploys over and above releases?

We're using deployments so that releases are properly tagged with an environment (e.g. production). If we don't do that, releases only get tagged with an environment if it receives session data which doesn't always happen since the time between two releases can be too short to allow it.

IGassmann avatar Sep 21 '22 11:09 IGassmann

I have it triggered 6 times.

ivadenis avatar Oct 06 '22 05:10 ivadenis

@lobsterkatie shouldn't the type of this issue be a bug?

IGassmann avatar Oct 06 '22 06:10 IGassmann

I have it triggered 6 times.

6? That's even more of a mystery! Is your release value maybe not getting updated?

@lobsterkatie shouldn't the type of this issue be a bug?

Enh? I guess it's really both. The improvement is not creating separate deploys for the frontend and backend builds. The bug is the fact that there are more than 2 getting created.

Sorry I haven't had a chance to dig into this yet.

lobsterkatie avatar Oct 06 '22 06:10 lobsterkatie

Closing this issue for cleanup. Please re-open if this still applies. Thanks!

AbhiPrasad avatar Jul 27 '23 16:07 AbhiPrasad