Skip to content

fix(dev): Do not export SENTRY_DSN in .envrc #35440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2022

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Jun 7, 2022

We started exporting SENTRY_DSN back in #32524 in order to fix errors in lib.sh not being reported.

Having this variable exported can cause a lot of errors from a developers' development to show up as dev env errors.

Exporting inside of lib.sh does not persist in the developers' environment.

We started exporting SENTRY_DSN back in #32524 in order to fix errors in lib.sh not being reported.

Having this variable exported can cause a lot of errors from a developers' development to show up as dev env errors.

Exporting inside of lib.sh does not persist in the developers' environment.
@@ -142,8 +143,6 @@ fi
if [ -n "${SENTRY_DEVENV_NO_REPORT+x}" ]; then
debug "No development environment errors will be reported (since you've defined SENTRY_DEVENV_NO_REPORT)."
else
# This is necessary for the bash-hook in lib.sh to work
export SENTRY_DSN="https://[email protected]/5723503"
Copy link
Member Author

Choose a reason for hiding this comment

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

When exporting via direnv, any Sentry error reporting in the code will pick up the reserved variable.

@@ -16,13 +16,8 @@ if sys.version_info.major < 3:
try:
import sentry_sdk

if os.environ.get("SENTRY_DSN"):
sentry_sdk.init(dsn=os.environ["SENTRY_DSN"])
Copy link
Member Author

Choose a reason for hiding this comment

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

I guess this block was redundant since init would have loaded automatically from the reserved variable.

@@ -28,10 +28,13 @@ configure-sentry-cli() {
# We can remove this after it's fixed
# https://github.com/getsentry/sentry-cli/pull/1059
export SENTRY_CLI_NO_EXIT_TRAP=${SENTRY_CLI_NO_EXIT_TRAP-0}
if [ -n "${SENTRY_DSN+x}" ] && [ -z "${SENTRY_DEVENV_NO_REPORT+x}" ]; then
if [ -z "${SENTRY_DEVENV_NO_REPORT+x}" ]; then
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we now don't export the variable.

if ! require sentry-cli; then
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.0.4 bash
fi
# This exported variable does not persist outside of the calling script, thus, not affecting other
# parts of the system
export SENTRY_DSN="https://[email protected]/5723503"
Copy link
Member Author

Choose a reason for hiding this comment

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

Once the script that calls configure-sentry-cli ends, the variable is lost and the potential impact contained.

@armenzg armenzg marked this pull request as ready for review June 7, 2022 19:03
@armenzg armenzg requested a review from a team as a code owner June 7, 2022 19:03
@armenzg
Copy link
Member Author

armenzg commented Jun 7, 2022

@asottile-sentry @Zylphrex would you mind testing that direnv works for you with this PR? (since you two were affected on #33826)

Copy link
Member

@asottile-sentry asottile-sentry left a comment

Choose a reason for hiding this comment

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

wfm

@armenzg armenzg merged commit 19b740a into master Jun 8, 2022
@armenzg armenzg deleted the armenzg/dev/fix-dev-env-error-reporting branch June 8, 2022 12:31
antonpirker pushed a commit that referenced this pull request Jun 8, 2022
We started exporting SENTRY_DSN back in #32524 in order to fix errors in lib.sh not being reported.

Having this variable exported can cause a lot of errors from a developers' development to show up as dev env errors.

Exporting inside of lib.sh does not persist in the developers' environment.
@github-actions github-actions bot locked and limited conversation to collaborators Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: Developer Environment This covers issues related to setting up a developer's environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants