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:
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.2 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Additional Details:
- This issue persists across multiple Convex versions (1.25.0, 1.26.1, 1.26.2)
- Issue occurs in both existing projects and completely new projects
- Issue persists after clearing global Convex state (
~/.convex/
)
- Issue persists after reinstalling Convex CLI globally
- Issue persists after removing and regenerating all generated files
- Issue affects both the main project and test projects created in different directories
Impact:
This is a critical blocker that prevents any Convex client application from working. The mobile app crashes immediately when trying to import the generated API types.
Workaround Attempts:
- Downgraded Convex to 1.25.0 (issue persists)
- Cleared global Convex state (issue persists)
- Reinstalled Convex CLI (issue persists)
- Removed and regenerated all generated files (issue persists)
- Created projects in different directories (issue persists)
Files Affected:
- convex/_generated/api.js
- convex/_generated/api.d.ts
Reproduction Rate:
100% - The issue occurs every time npx convex codegen
is run, regardless of the project or environment.