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

Identifying User by username produces an Error #1107

Closed
ahaurat opened this issue Oct 2, 2020 · 5 comments · Fixed by #1108
Closed

Identifying User by username produces an Error #1107

ahaurat opened this issue Oct 2, 2020 · 5 comments · Fixed by #1108
Milestone

Comments

@ahaurat
Copy link
Contributor

ahaurat commented Oct 2, 2020

According to the docs, one of id, username, email, or ip_address are required:
https://docs.sentry.io/platforms/javascript/guides/react/enriching-events/identify-user/

However, including only a username produces an error due to this line:

if (!isset($data['id']) && !isset($data['ip_address'])) {

@ste93cry
Copy link
Collaborator

ste93cry commented Oct 2, 2020

This is in conflict with https://develop.sentry.dev/sdk/event-payloads/user/ which says that You should provide at least either an `id` (a unique identifier for an authenticated user) or `ip_address` (their IP address). @HazAT what's the correct behavior?

@ste93cry ste93cry added this to the 3.0 milestone Oct 2, 2020
@ahaurat
Copy link
Contributor Author

ahaurat commented Oct 2, 2020

If it helps, I can verify that the sentry-python package allows username only. We have been using that as our identifier on python projects and so would like to be consistent and do the same in our PHP projects if possible.

@ahaurat
Copy link
Contributor Author

ahaurat commented Oct 2, 2020

Went ahead and created a PR in case it's determined that username and email are valid identifiers. Thanks for taking a look at this!

@kamilogorek
Copy link
Contributor

@ste93cry docs were not exhaustive enough, so they are not updated from:

You should provide at least either an id (a unique identifier for an authenticated user) or ip_address (their IP address).

to:

You should provide at least one of id, email, ip_address, username for Sentry to be able to tell you how many users are affected by one issue (for example). Sending a user that has none of these attributes (and only custom attributes) is valid, but not as useful.

So UserDataBag.php guard is not necessary and can be safely removed.

@stayallive
Copy link
Collaborator

3.0.3 was just released fixing this 👍

Thank you for the report, and also for starting the fix 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants