fix(api): add missing apiKeys trpc route#29476
Conversation
|
Welcome to Cal.diy, @satyamkasaudhan07! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
📝 WalkthroughWalkthroughThis PR adds a new API route file that creates a TRPC Next.js handler for API keys operations. The file imports 🚥 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 |
|
@satyamkasaudhan07 can u please add a before-after demo of ur changes in the description? making it draft til then |
Thanks for the feedback. I've updated the PR description with the before/after demo and screenshots. Please let me know if you'd like any additional verification or changes. |
|
@satyamkasaudhan07 your screenshot should prove that the fix you are trying to implement actually works. Please replace those with correct ones. Run the fix locally and submit a video/image demo of the app. For more : take a look at this PR description: #28827 |
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
The issue reported that API key creation failed because the standalone
tRPC endpoint route was missing.
After
Added the missing route:
apps/web/pages/api/trpc/apiKeys/[trpc].ts
Notes
The fix follows the same standalone endpoint pattern used by other tRPC routes in the repository.