fix(api): missing trpc route added for the api keys#29517
Conversation
|
Welcome to Cal.diy, @Kathircpe! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
📝 WalkthroughWalkthroughThis PR adds a new tRPC API route handler at apps/web/pages/api/trpc/apiKeys/[trpc].ts. The file imports the Next.js tRPC handler factory and the apiKeysRouter, then exports a default handler that wires them together. This creates the HTTP endpoint through which clients can invoke tRPC procedures defined in the apiKeys router. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
72460ad to
55f8596
Compare
|
@Kathircpe looks good. Can u also add tests for this? |
Fixes #29475
Summary
Fixes API key creation failure caused by a missing standalone tRPC endpoint.
Problem
Creating API keys from
/settings/developer/api-keysreturned:Unexpected token '<', "<!DOCTYPE "... is not valid JSON
because
/api/trpc/apiKeys/createreturned an HTML 404 page instead of a JSON tRPC response.Root Cause
The API keys router existed, but the Next API route exposing the standalone endpoint was missing.
Fix
Added:
apps/web/pages/api/trpc/apiKeys/[trpc].tsto expose the existing
apiKeysRouterthroughcreateNextApiHandler.Before
After
Notes
The fix follows the same standalone endpoint pattern used by other tRPC routes in the repository.