Skip to content

draft: check redirect url#1021

Closed
alexdln wants to merge 4 commits intonpmx-dev:mainfrom
alexdln:draft/check-oauth-error
Closed

draft: check redirect url#1021
alexdln wants to merge 4 commits intonpmx-dev:mainfrom
alexdln:draft/check-oauth-error

Conversation

@alexdln
Copy link
Copy Markdown
Member

@alexdln alexdln commented Feb 5, 2026

Just checking oauth error in vercel environment

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 5, 2026 1:30pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 5, 2026 1:30pm
npmx-lunaria Ignored Ignored Feb 5, 2026 1:30pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

The GET handler at server/api/auth/atproto.get.ts was simplified to return the OAuth client metadata (clientMetadata) directly. All code handling OAuth initiation, callbacks, session storage, redirects and related flow was removed. No exported or public signatures were changed.

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description relates to the changeset, indicating an investigation of OAuth errors in Vercel, which aligns with the simplified OAuth handler changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Comment thread server/api/auth/atproto.get.ts Outdated
prompt: create ? 'create' : undefined,
})
return sendRedirect(event, redirectUrl.toString())
return redirectUrl
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.

⚠️ Potential issue | 🔴 Critical

Returning redirectUrl breaks the OAuth authorization flow.

OAuth requires the browser to be redirected to the authorization server. Returning the URL object directly causes it to be serialised as JSON, which prevents the redirect from occurring and breaks authentication.

If this is intentional for debugging the redirect URL in Vercel, consider logging the URL before performing the redirect instead:

🐛 Suggested fix to preserve OAuth flow whilst enabling debugging
       const redirectUrl = await atclient.authorize(handle, {
         scope,
         prompt: create ? 'create' : undefined,
       })
-      return redirectUrl
+      console.log('[OAuth Debug] Redirect URL:', redirectUrl.toString())
+      return sendRedirect(event, redirectUrl.toString())
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return redirectUrl
console.log('[OAuth Debug] Redirect URL:', redirectUrl.toString())
return sendRedirect(event, redirectUrl.toString())

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
server/api/auth/atproto.get.ts (1)

70-72: ⚠️ Potential issue | 🟡 Minor

Remove or use the unused create variable to satisfy lint and avoid dead code.

The CI lint warning indicates create is unused.

🧹 Proposed fix
-      const create = query.create?.toString()
+      // const create = query.create?.toString()

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
server/api/auth/atproto.get.ts (1)

1-11: ⚠️ Potential issue | 🟡 Minor

Resolve the lint failures by removing now-unused imports.

ESLint is currently failing for unused imports in this block. Please remove the unused imports or reintroduce their usage so the pipeline passes.

@@ -54,77 +54,5 @@ export default defineEventHandler(async event => {

const query = getQuery(event)
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.

⚠️ Potential issue | 🟡 Minor

Remove the unused query variable to fix the lint warning.

Line 55 declares query but never uses it; this is already flagged by ESLint.

Suggested fix
-  const query = getQuery(event)
+  // const query = getQuery(event) // remove if not needed
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const query = getQuery(event)
// const query = getQuery(event) // remove if not needed
Suggested change
const query = getQuery(event)
🧰 Tools
🪛 GitHub Actions: autofix.ci

[warning] 55-55: ESLint: 'query' is declared but never used. (no-unused-vars) - Consider renaming to _query or using it.

@alexdln alexdln closed this Feb 5, 2026
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