Disable Notion connect button when OAuth credentials are absent #SUPERLOG - #454
Open
superlog-app[bot] wants to merge 1 commit into
Open
Disable Notion connect button when OAuth credentials are absent #SUPERLOG#454superlog-app[bot] wants to merge 1 commit into
superlog-app[bot] wants to merge 1 commit into
Conversation
…RLOG Delivery-Id: d100c4a1ae5359642bf3f5fa078ca07ef482e922431a738864409cc7fe5e066e Delivery-Base: main
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
Users visiting the Settings page and clicking Connect Notion receive an unhandled promise rejection that generates a browser OTel error span (
ApiError: 503: {"error":"notion not configured"}). This happens becausePOST /api/notion/install-urlreturns 503 whenNOTION_CLIENT_ID,NOTION_CLIENT_SECRET, orSTATE_SIGNING_SECRETare not set, but theonClickhandler awaits the mutation without atry/catch, so the rejection surfaces aswindow.unhandledrejection.The deeper issue is that
GET /api/notion/installationpreviously returned{installed: false}with no indication of whether the OAuth flow is even available on this deployment, leaving the frontend no signal to preemptively disable the Connect button.Root cause
The
GET /api/notion/installationendpoint did not expose whether Notion env vars are configured. The frontend always rendered an enabled Connect button, and when clicked, the resulting 503 fromPOST /api/notion/install-urlbecame an unhandled rejection because theonClickhandler lacked error handling.Remediation
apps/api/src/notion.ts:mountNotionAuthednow computesconfigurable = !!(clientId && clientSecret && stateSecret)once at mount time and includes it in everyGET /api/notion/installationresponse variant ({installed: false, configurable}and the full installed shape).apps/web/src/api.ts:NotionInstallationtype extended with optionalconfigurable?: booleanon both variants.apps/web/src/Settings.tsx:NotionCardreadsinstall.data?.configurable !== false(defaults totruewhen the field is absent — safe for old cached data or older API versions), disables the Connect button whenconfigurableis false, and renders a short explanatory paragraph so users understand why the button is unavailable.No changes to the 503 guard on
POST /api/notion/install-url— that guard is intentional and stays in place as a server-side safety net.Incident: balmy-newt (415a04f7-e9b3-48b0-8278-f60e6857aa70)
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Disable the Notion Connect button when OAuth credentials are not configured, and show a clear message to avoid unhandled rejections and 503 noise. The API now exposes a
configurableflag viaGET /api/notion/installationso the UI can decide availability.GET /api/notion/installationincludesconfigurablecomputed fromNOTION_CLIENT_ID,NOTION_CLIENT_SECRET, andSTATE_SIGNING_SECRET.configurableis false and shows a short explanation.NotionInstallationextended with optionalconfigurableon both variants (defaults to true if absent for compatibility).Written for commit 2837cd5. Summary will update on new commits.