Skip to content

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.
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.

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.

# 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.

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
Contributor

@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.

4 participants