Skip to content

fix(api): missing trpc route added for the api keys#29517

Open
Kathircpe wants to merge 1 commit into
calcom:mainfrom
Kathircpe:bug/apikey-trpc-route
Open

fix(api): missing trpc route added for the api keys#29517
Kathircpe wants to merge 1 commit into
calcom:mainfrom
Kathircpe:bug/apikey-trpc-route

Conversation

@Kathircpe
Copy link
Copy Markdown

@Kathircpe Kathircpe commented Jun 6, 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

IMG_20260606_213625

After

IMG_20260606_213614 IMG_20260606_213645

Notes

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

Welcome to Cal.diy, @Kathircpe! 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
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

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:

No release type found in pull request title "fix(api):missing trpc route added for the api keys". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

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

coderabbitai Bot commented Jun 6, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This 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)
Check name Status Explanation
Linked Issues check ✅ Passed The PR directly addresses issue #29475 by adding the missing Next API route file that mounts apiKeysRouter via createNextApiHandler, exactly as proposed.
Out of Scope Changes check ✅ Passed All changes are in-scope: the single file addition directly addresses the linked 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 description is directly related to the changeset and clearly explains the problem, root cause, and solution implemented.
Title check ✅ Passed The title directly describes the main change: adding a missing tRPC route for API keys. It accurately reflects the changeset's purpose and follows concise, clear naming conventions.

✏️ 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.

@Kathircpe Kathircpe force-pushed the bug/apikey-trpc-route branch from 72460ad to 55f8596 Compare June 6, 2026 16:10
@Kathircpe Kathircpe changed the title missing trpc route added for the api keys fix(api):missing trpc route added for the api keys Jun 6, 2026
@Kathircpe Kathircpe changed the title fix(api):missing trpc route added for the api keys fix(api): missing trpc route added for the api keys Jun 6, 2026
@bandhan-majumder
Copy link
Copy Markdown
Member

@Kathircpe looks good. Can u also add tests for this?

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