-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add workos doctor command for diagnosing integration issues
#50
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
Merged
Conversation
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
Introduces a new diagnostic command that checks: - SDK detection and version status - Framework detection (Next.js, React Router, etc.) - Runtime info (Node.js, package manager) - Environment variables (API key, client ID) - API connectivity and latency Outputs actionable remediation steps for any issues found. Supports --json for scripting and --skip-api for offline mode.
…validation Phase 2 enhancements to the doctor command: - Fetch dashboard settings from WorkOS API (staging only, production blocked) - Validate credentials against /organizations endpoint - Detect redirect URI mismatches between code and dashboard - Add --json flag for machine-readable output - Add --verbose flag for additional diagnostic details - Add --copy flag for cross-platform clipboard support - Support both @workos/* and @workos-inc/* SDK package scopes - Load environment variables from project's .env and .env.local files
…ion comparison - Use dotenv parser for proper .env handling (multiline, exports, inline comments) - Normalize redirect URIs before comparison (trailing slashes, localhost variants) - Handle prerelease/workspace versions gracefully in outdated check - Surface dashboard API errors instead of failing silently
The mismatch may be intentional or dashboard data may be incomplete.
- Compute expected redirect URI from framework callback path + detected port
- Add source tracking ('env' vs 'inferred') for redirect URI
- Fix TanStack Start detection (check @tanstack/react-start before @tanstack/react-router)
- Remove version number from doctor header (it's part of the CLI, not standalone)
- Use array for framework detection order to guarantee specificity
WorkOS API doesn't expose an endpoint to list configured redirect URIs. The management API only supports POST (create), not GET (list). - Remove false mismatch warnings - Show expected redirect URI with note to verify manually in dashboard
- Remove duplicate CredentialValidation interface from dashboard.ts (import from types.ts instead) - Merge 3 redundant /organizations?limit=1 calls into 1 by folding credential validation into fetchDashboardSettings - Pass resolved project env base URL to connectivity check instead of reading process.env directly - Fix cross-platform copy hint (--copy flag instead of pbcopy)
8bc2c3c to
fe30f12
Compare
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
Adds
workos doctor— a diagnostic command that detects common WorkOS integration issues in one command. DSE team spends significant time in support conversations gathering basic diagnostic information ("What SDK?", "What version?", "Redirect URI?"). This command automates that info-gathering so customers can run a single command and share the output.What it does
Runs a suite of diagnostic checks against the user's project:
@workos/*,@workos-inc/*,workos), reports version, checks npm registry for latest.env/.env.localforWORKOS_API_KEY,WORKOS_CLIENT_ID,WORKOS_REDIRECT_URI,WORKOS_COOKIE_DOMAIN,WORKOS_BASE_URL. Identifies staging vs production from key prefixapi.workos.comCLI flags
--json--copy--verbose--skip-api--install-dirSecurity
configured/not set) and type (staging/production)client_01J...7KM)EnvironmentRaw) and excluded from report outputExit codes
0— healthy, no errors1— critical issues found (or doctor itself failed)Architecture
Checks run concurrently via
Promise.allwhere possible (SDK, framework, runtime, connectivity), then sequential for checks that depend on environment results (credential validation, dashboard settings).Success criteria from contract
--json--copyflag for clipboard