Skip to content

fix(auth): resolve /api/v1/auth/config 404 on Vercel deployment - #1214

Merged
hotlong merged 1 commit into
mainfrom
claude/fix-api-auth-config-404-error
Apr 23, 2026
Merged

hotlong merged 1 commit into
mainfrom
claude/fix-api-auth-config-404-error

Conversation

@Claude

@Claude Claude AI commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

The /api/v1/auth/config endpoint returned 404 on Vercel while working locally. Root cause: route ordering conflict between Hono adapter's catch-all /auth/* route and AuthPlugin's specific /auth/config registration.

Changes

Hono Adapter (packages/adapters/hono/src/index.ts)

  • Intercept /auth/config requests before forwarding to better-auth
  • Call authService.getPublicConfig() directly for this endpoint

AuthPlugin (packages/plugins/plugin-auth/src/auth-plugin.ts)

  • Remove duplicate /auth/config route registration from registerAuthRoutes()
  • Add comment explaining the endpoint is now handled in the adapter

Tests (packages/plugins/plugin-auth/src/auth-manager.test.ts)

  • Update expectations to include type: 'social' field in provider responses

Technical Detail

Hono uses first-match-wins routing. The adapter creates its Hono app with a catch-all /api/v1/auth/* route before AuthPlugin can register specific routes in the kernel:ready hook. Since better-auth doesn't handle /config (it's an ObjectStack-specific endpoint), requests were falling through to the dispatcher's mock fallback which doesn't implement this endpoint.

// Now handled in adapter before better-auth forwarding
if (path === 'config' && method === 'GET' && authService) {
  const config = authService.getPublicConfig();
  return c.json({ success: true, data: config });
}

- Handle /auth/config endpoint before forwarding to better-auth
- Remove duplicate route registration from AuthPlugin to avoid conflicts
- Update test expectations for getPublicConfig() type field

Fixes: Vercel deployment 404 error for /api/v1/auth/config

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/47d028d7-dd4e-44b3-a99b-226e4322a548

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@vercel

vercel Bot commented Apr 23, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
objectstack-demo Ready Ready Preview, Comment Apr 23, 2026 8:18am
spec Error Error Apr 23, 2026 8:18am

Request Review

This branch had an error being deployed

1 failed and 1 active deployments
Preview – spec — db440bff Deployed Apr 23, 2026 by vercel[bot]
Preview – objectstack-demo — db440bff Deployed Apr 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants