Skip to content

fix(api): add missing apiKeys trpc route#29476

Draft
satyamkasaudhan07 wants to merge 1 commit into
calcom:mainfrom
satyamkasaudhan07:fix-api-keys-route
Draft

fix(api): add missing apiKeys trpc route#29476
satyamkasaudhan07 wants to merge 1 commit into
calcom:mainfrom
satyamkasaudhan07:fix-api-keys-route

Conversation

@satyamkasaudhan07
Copy link
Copy Markdown

@satyamkasaudhan07 satyamkasaudhan07 commented May 28, 2026

Fixes #29475

Summary

Fixes API key creation failure caused by a missing standalone tRPC endpoint.

Problem

Creating API keys from /settings/developer/api-keys returned:

Unexpected token '<', "<!DOCTYPE "... is not valid JSON

because /api/trpc/apiKeys/create returned 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].ts

to expose the existing apiKeysRouter through createNextApiHandler.

Before

The issue reported that API key creation failed because the standalone
tRPC endpoint route was missing.

image

After

Added the missing route:

apps/web/pages/api/trpc/apiKeys/[trpc].ts

image

Notes

The fix follows the same standalone endpoint pattern used by other tRPC routes in the repository.

@github-actions
Copy link
Copy Markdown
Contributor

Welcome to Cal.diy, @satyamkasaudhan07! Thanks for opening this pull request.

A few things to keep in mind:

  • This is Cal.diy, not Cal.com. Cal.diy is a community-driven, fully open-source fork of Cal.com licensed under MIT. Your changes here will be part of Cal.diy — they will not be deployed to the Cal.com production app.
  • Please review our Contributing Guidelines if you haven't already.
  • Make sure your PR title follows the Conventional Commits format.

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added the 🐛 bug Something isn't working label May 28, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a new API route file that creates a TRPC Next.js handler for API keys operations. The file imports createNextApiHandler from the TRPC infrastructure and apiKeysRouter from the router module, then wires them together and exports the resulting handler as the default export. This establishes the HTTP endpoint at /api/trpc/apiKeys/[trpc] for TRPC procedure calls.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a missing tRPC API route for apiKeys that resolves the API key creation failure.
Linked Issues check ✅ Passed The pull request directly addresses issue #29475 by adding the missing tRPC API route that exposes the apiKeysRouter, exactly as specified in the proposed fix.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped to adding the single missing API route file required to fix the issue, with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly explains the problem (missing tRPC endpoint), root cause, solution, and provides context with before/after screenshots.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

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

@bandhan-majumder
Copy link
Copy Markdown
Member

bandhan-majumder commented Jun 2, 2026

@satyamkasaudhan07 can u please add a before-after demo of ur changes in the description? making it draft til then

@bandhan-majumder bandhan-majumder marked this pull request as draft June 2, 2026 12:44
@satyamkasaudhan07
Copy link
Copy Markdown
Author

@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 satyamkasaudhan07 marked this pull request as ready for review June 2, 2026 13:23
@bandhan-majumder bandhan-majumder marked this pull request as draft June 2, 2026 14:12
@bandhan-majumder
Copy link
Copy Markdown
Member

bandhan-majumder commented Jun 2, 2026

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HIGH: API key creation returns HTML 404, causing Unexpected token '<' ... is not valid JSON

2 participants