Skip to content

Conversation

@lforst
Copy link
Contributor

@lforst lforst commented Apr 16, 2023

We changed the Next.js SDK to upload source maps for every deployment target in getsentry/sentry-javascript#7436. This requires the Vercel integration to follow suite.

Fixes getsentry/sentry-docs#5690
Fixes getsentry/sentry-javascript#5619

@lforst lforst requested a review from a team April 16, 2023 11:38
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 16, 2023
@codecov
Copy link

codecov bot commented Apr 16, 2023

Codecov Report

Merging #47441 (928e951) into master (73418d5) will increase coverage by 17.98%.
The diff coverage is 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #47441       +/-   ##
===========================================
+ Coverage   62.70%   80.68%   +17.98%     
===========================================
  Files        4724     4760       +36     
  Lines      199971   201409     +1438     
  Branches    11629    11629               
===========================================
+ Hits       125389   162506    +37117     
+ Misses      74324    38645    -35679     
  Partials      258      258               
Impacted Files Coverage Δ
src/sentry/integrations/vercel/integration.py 92.76% <100.00%> (+48.02%) ⬆️

... and 1335 files with indirect coverage changes

"key": key,
"value": value,
"target": ["production"],
"target": ["production", "preview", "development"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would having development work well here? Vercel itself wouldn't be running anything on development, so this would be environment variables that are pulled down for local use.

In localhost, you might run code in files that aren't committed yet. What would happen in terms of releases then?

In my perspective, an error without a source map for JavaScript should not exist. Would this change not make more of those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, lemme think about this. When running vercel dev, we are building/running Next.js in development mode where we don't upload source maps anyhow. The errors thrown in dev mode should be dynamically source mapped - we built this in getsentry/sentry-javascript#7294. So I think you have a point here.

BUT, people are not exclusively deploying Next.js apps to Vercel. I think it might be beneficial to have the env vars available if you have added the integration for different kinds of setups. For example, we're currently working on a sveltekit SDK which might make use of the variables.

What do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are ways in which it makes a lot of sense. Having the DSN in .env seems like a good thing for example. It makes sense to have more of the data locally for other types of projects I too I guess. My only concern is that one of your env vars is VERCEL_GIT_COMMIT_SHA That wouldn't work locally. Would it be somehow pulled as well? I think it might have to be excluded?

But as long as the default setup from npx @sentry/wizard -s -i nextjs can handle that, and with also when #5734 is fixed, I think it's fine to have them on development as well.

I personally don't use vercel dev, so I don't know what that does.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is that one of your env vars is VERCEL_GIT_COMMIT_SHA That wouldn't work locally. Would it be somehow pulled as well? I think it might have to be excluded?

Ah, you're right. Gonna exclude this from the development target. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not even SENTRY_AUTH_TOKEN is needed locally, and it is probably even dangerous to put it onto users' machines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually actually no env vars besides the DSN are useful in development

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not SENTRY_PROJECT or SENTRY_ORG even?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, they're only used for uploading source maps, which we don't do in dev mode.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good then! Thanks for discussing.

@lforst lforst merged commit 3994b3b into master Apr 18, 2023
@lforst lforst deleted the lforst-vercel-integration-all-environments-env-vars branch April 18, 2023 09:19
@github-actions github-actions bot locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[nextjs] Document behavior on Vercel [nextjs] Improve webpack plugin enablement and warnings

4 participants