Skip to content
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

fix: discourage authToken usage and link to updated docs #325

Merged
merged 5 commits into from
Mar 15, 2023

Conversation

byCedric
Copy link
Member

@byCedric byCedric commented Mar 15, 2023

Checklist

Why

See #321

How

Added a warning whenever you configure authToken through the post-publish hook.

Test Plan

  • $ yarn create expo-app ./test-authtoken
  • $ cd ./test-authtoken
  • $ yarn expo install sentry-expo
  • Configure app.json with the post-publish token, including authToken
  • $ yarn expo prebuild
  • Warning should be visible

Comment on lines +58 to +67
if (sentryHook.config?.authToken) {
WarningAggregator.addWarningAndroid(
'sentry-expo',
'Sentry `authToken` found in app.json. Avoid committing this value to your repository, configure it through `SENTRY_AUTH_TOKEN` environment variable instead. See: https://docs.expo.dev/guides/using-sentry/#app-configuration'
);
WarningAggregator.addWarningIOS(
'sentry-expo',
'Sentry `authToken` found in app.json. Avoid committing this value to your repository, configure it through `SENTRY_AUTH_TOKEN` environment variable instead. See: https://docs.expo.dev/guides/using-sentry/#app-configuration'
);
}
Copy link

Choose a reason for hiding this comment

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

"authToken" also needs to be omitted from the missingProperties array at line 74 so that it doesn't warn the user that the field is missing.

Copy link
Member Author

@byCedric byCedric Mar 15, 2023

Choose a reason for hiding this comment

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

@jamsch The missing properties doesn't warn users when not defined. The only thing it's doing is adding a comment within the generated sentry.properties file to mention that it's falling back to the SENTRY_AUTH_TOKEN.

We could modify that comment, but I do think it could be useful when users stumble upon the configuration after running $ npx expo prebuild.

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've updated the message, and added another comment when using authToken. Just to cover users ignoring the warning, and opening the sentry.properties file.

Copy link

Choose a reason for hiding this comment

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

@byCedric Could you double check that? I'm currently forced to set authToken to false in the config in order for the WarningAggregator message to disappear.

Copy link
Member Author

@byCedric byCedric Mar 15, 2023

Choose a reason for hiding this comment

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

@jamsch, can you try on commit bc69f0d? that should take care of that.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jamsch, just released this: 6.1.1. Thanks for your help :)

@byCedric byCedric force-pushed the @bycedric/auth-token/add-warning-when-using-auth-token branch from 50644d9 to 4f3bc60 Compare March 15, 2023 12:38
@byCedric byCedric merged commit 459a822 into main Mar 15, 2023
@byCedric byCedric deleted the @bycedric/auth-token/add-warning-when-using-auth-token branch March 15, 2023 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants