Skip to content

fix(slack): Use set_user for user context in Slack event webhook#112530

Merged
DominikB2014 merged 2 commits intomasterfrom
dominikbuszowiecki/dain-1475-no-results-for-useremail-in-extensions-endpoint
Apr 8, 2026
Merged

fix(slack): Use set_user for user context in Slack event webhook#112530
DominikB2014 merged 2 commits intomasterfrom
dominikbuszowiecki/dain-1475-no-results-for-useremail-in-extensions-endpoint

Conversation

@DominikB2014
Copy link
Copy Markdown
Contributor

@DominikB2014 DominikB2014 commented Apr 8, 2026

Replace set_tag("user.email", ...) with set_user({"id", "email", "username"}) in the Slack event webhook's on_link_shared handler.

Previously, user.email was set via set_tag("user.email", ...) which stored it under the wrong attribute key, causing user.email to never appear in EAP span queries for spans with slack.event_type. Using set_user() stores the values under the correct sentry.user.* attributes that match the EAP search definitions. Also adds user.id (as string) and user.username to enrich the user context.

Replace set_tag("user.email", ...) with set_user({"email": ...}) so the
user email is properly stored as sentry.user.email in span attributes,
matching the EAP search attribute definition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 8, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 8, 2026
@DominikB2014 DominikB2014 requested a review from a team April 8, 2026 20:58
@DominikB2014 DominikB2014 marked this pull request as ready for review April 8, 2026 20:58
@DominikB2014 DominikB2014 requested review from a team as code owners April 8, 2026 20:58
Enrich the user context with id and username in addition to email,
populating sentry.user.id and sentry.user.username on spans.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DominikB2014 DominikB2014 enabled auto-merge (squash) April 8, 2026 21:00
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bbc6237. Configure here.

sentry_sdk.set_tag("user.email", identity_user.email)
sentry_sdk.set_user(
{
"id": identity_user.id,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

User ID passed as int instead of string

Medium Severity

The id field from identity_user.id is an int, but sentry_sdk.set_user expects a string for user.id. This type mismatch can prevent the user.id attribute from being indexed or searchable correctly in EAP, as downstream storage expects a string.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bbc6237. Configure here.

@DominikB2014 DominikB2014 merged commit 39c0754 into master Apr 8, 2026
56 checks passed
@DominikB2014 DominikB2014 deleted the dominikbuszowiecki/dain-1475-no-results-for-useremail-in-extensions-endpoint branch April 8, 2026 21:11
@DominikB2014 DominikB2014 changed the title fix(slack): Use set_user for email in Slack event webhook fix(slack): Use set_user for user context in Slack event webhook Apr 8, 2026
DominikB2014 added a commit that referenced this pull request Apr 8, 2026
Follow-up to #112530. `sentry_sdk.set_user` expects a string for the
`id` field. The previous PR passed `identity_user.id` as an int, which
can prevent `user.id` from being indexed correctly in EAP spans.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
Replace `set_tag("user.email", ...)` with `set_user({"email": ...})` so
the
user email is properly stored as `sentry.user.email` in span attributes,
matching the EAP search attribute definition. Previously, `user.email`
was
never populated for spans with `slack.event_type` because the tag key
didn't
match the expected internal attribute name.

Also add a few other fields to user

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
Follow-up to #112530. `sentry_sdk.set_user` expects a string for the
`id` field. The previous PR passed `identity_user.id` as an int, which
can prevent `user.id` from being indexed correctly in EAP spans.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants