Handle Sentry org with no accessible projects during OAuth callback #SUPERLOG - #448
Open
superlog-app[bot] wants to merge 1 commit into
Open
Handle Sentry org with no accessible projects during OAuth callback #SUPERLOG#448superlog-app[bot] wants to merge 1 commit into
superlog-app[bot] wants to merge 1 commit into
Conversation
…SUPERLOG Delivery-Id: 56d297e7014004c4e3c80ff6c31135e8cbcc2a759af0170167c6a90cff9eab55 Delivery-Base: main
| 302, | ||
| ); | ||
| } catch (error) { | ||
| if (error instanceof SentryNoProjectsError) { |
Contributor
Author
There was a problem hiding this comment.
logs · warning — Add the Sentry org identifier to the no-projects warn log
Include the Sentry organization slug or ID (available from callback.state or the token exchange response) as a structured field so operators can immediately scope the incident to a specific tenant without correlating surrounding log lines. Without it, a spike of no-projects warnings cannot be attributed to a single misconfigured org versus a systemic API change.
Suggested change
| if (error instanceof SentryNoProjectsError) { | |
| log.warn({ err: error, sentryOrgSlug: callback.state.sentryOrgSlug ?? undefined }, "sentry oauth callback: no accessible projects"); |
Useful? React with 👍 / 👎.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a user connects Sentry but the Superlog app has no access to any projects in their Sentry organization, the OAuth callback fails with a misleading or completely absent error message.
Onboarding flow: Users see "Sentry connected incompletely. Reconnect to retry the issue import." — misleading because reconnecting won't help; they need to grant the Superlog app project access in Sentry first.
Settings flow: No error message is shown at all. The
?sentry=errorparam only scrolls the Sentry card into view butSentryCardhad no code to read or display the outcome.Root cause
planSentryProjectSelection([])throws a plainErrorwhen the Sentry API returns an empty project list (HTTP 200, empty array). The generic catch block in the OAuth callback handler catches this alongside unexpected system errors, logs it at ERROR severity, and redirects with?sentry=error. There was no way for the UI to distinguish "no projects accessible" from other failure modes.Fix
project-selection.ts— Export a newSentryNoProjectsErrorclass so the callback handler can identify this condition specifically.installation.ts— Add a branch in the catch block:SentryNoProjectsErroris logged at WARN (user configuration issue, not a system fault) and redirects with?sentry=no-projects. Generic errors still log at ERROR and redirect with?sentry=error. ThesentryOAuthRedirectoutcome union gains"no-projects".SentryConnectFlow.tsx— Handle the"no-projects"outcome with an actionable message: "Your Sentry organization has no accessible projects. Grant the Superlog app access to at least one project in Sentry, then reconnect."Settings.tsx SentryCard— AddoutcomeErrorstate +useEffectto read and clear the?sentry=param, displaying tailored messages for"denied","error", and"no-projects".All 11 installation tests and 3 project-selection tests pass.
tsc --noEmitis clean.Incident: e94db2d5-1ca7-47f4-8277-cd16fcb71336
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Handle Sentry OAuth when an org has no accessible projects, and show a clear “no projects” message. This fixes misleading/missing errors in onboarding and settings and guides users to grant project access before reconnecting.
SentryNoProjectsErrorand catch it in the OAuth callback to redirect with?sentry=no-projects(logged as WARN).?sentryparam and also handles “denied” and “error”.Written for commit 1581aff. Summary will update on new commits.