BarabbasRedeemedB
Convex Community5mo ago
2 replies
BarabbasRedeemed

Sanity check needed - Cursor blaming 'anyApi' in client-side codegen for build issues.

Sorry if this is the wrong place to put this, I'm just at my witts end troubleshooting this issue I encountered today. Can anyone tell me if this bug report makes sense, and even better if there's actionable steps to resolve it?


Bug Report: Convex codegen consistently generates anyApi from convex/server instead of proper client-side API types

Environment:
- OS: macOS 15.6.1 (darwin 24.6.0)
- Node.js: >=18
- Convex CLI: 1.26.2 (also tested 1.25.0)
- Convex package: 1.26.2 (also tested 1.25.0)
- Project: React Native app with Convex backend

Issue Description:
The npx convex codegen command consistently generates incorrect API types in convex/_generated/api.js. Instead of generating proper client-side API types, it generates:

import { anyApi } from "convex/server";

export const api = anyApi;
export const internal = anyApi;


This causes the application to crash because anyApi from convex/server is server-side code that cannot be imported in client-side contexts.

Steps to Reproduce:
1. Create a new Convex project: npx convex dev --configure new
2. Add a simple Convex function with proper validators
3. Run npx convex codegen
4. Check convex/_generated/api.js

Expected Behavior:
The generated api.js should contain proper client-side API types that can be imported and used in client applications.

Actual Behavior:
The generated api.js contains anyApi imports from convex/server, which causes runtime crashes when imported in client-side code.
Was this page helpful?