Skip to content

feat/sentry user implementation #910

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

feat/sentry user implementation #910

wants to merge 9 commits into from

Conversation

egelhaus
Copy link
Collaborator

What kind of change does this PR introduce?

eg: Bug fix, feature, docs update, ...

Why was this change needed?

Please link to related issues when possible, and explain WHY you changed things, not WHAT you changed.

Other information:

eg: Did you discuss this change with anybody before working on it (not required, but can be a good idea for bigger changes). Any plans for the future, etc?

Checklist:

Put a "X" in the boxes below to indicate you have followed the checklist;

  • I have read the CONTRIBUTING guide.
  • I checked that there were not similar issues or PRs already open for this.
  • This PR fixes just ONE issue (do not include multiple issues or types of change in the same PR) For example, don't try and fix a UI issue and include new dependencies in the same PR.

Copy link

vercel bot commented Jul 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
postiz ⬜️ Ignored (Inspect) Aug 1, 2025 1:00pm

@egelhaus egelhaus requested a review from Copilot July 31, 2025 20:09
Copilot

This comment was marked as outdated.

@egelhaus egelhaus marked this pull request as ready for review August 1, 2025 09:29
@egelhaus egelhaus requested a review from Copilot August 1, 2025 12:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements Sentry user context integration across the Postiz monorepo to enhance error tracking by associating user information with Sentry events. The implementation provides automatic user context setting in both frontend and backend services.

  • Adds user context utilities for both React (frontend) and NestJS (backend) environments
  • Integrates automatic user context setting in authentication middleware and user components
  • Ensures proper cleanup of user context during logout operations

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
libraries/react-shared-libraries/src/sentry/sentry.user.context.ts Frontend utility functions for setting and clearing Sentry user context with custom UserInfo interface
libraries/nestjs-libraries/src/sentry/sentry.user.interceptor.ts NestJS interceptor for automatic user context setting on requests
libraries/nestjs-libraries/src/sentry/sentry.user.context.ts Backend utility functions using Prisma User model for Sentry context
apps/frontend/src/components/layout/user.context.tsx Integration of Sentry user context in React user context provider
apps/frontend/src/components/layout/logout.component.tsx Clear Sentry context during frontend logout
apps/backend/src/services/auth/auth.middleware.ts Set/clear Sentry context during authentication middleware
apps/backend/src/api/routes/users.controller.ts Clear Sentry context during backend logout endpoint

Comment on lines +52 to +54
Sentry.setTag('user.activated', null);
Sentry.setTag('user.provider', null);
Sentry.setTag('user.super_admin', null);
Copy link
Preview

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

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

Setting tags to null may not properly clear them in Sentry. Consider using empty strings or calling Sentry.removeTag() if available, to ensure tags are properly cleared.

Suggested change
Sentry.setTag('user.activated', null);
Sentry.setTag('user.provider', null);
Sentry.setTag('user.super_admin', null);
Sentry.setTag('user.activated', '');
Sentry.setTag('user.provider', '');
Sentry.setTag('user.super_admin', '');

Copilot uses AI. Check for mistakes.

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.

1 participant