Type instantiation is excessively deep and possibly infinite.ts for monorepo
This is happening to both internal and api (import { internal, api } from "./_generated/api")
I've tried to simplify my schema, but to no avail. I am using the union validator, but on it's own variable.
7 Replies
This is generally due to using
ctx.runQuery/Mutation/Action
somewhere and returning the value. Find the latest place you used one of the ctx.run*
functions and you'll probably find your culprit. More here: https://docs.convex.dev/functions/actions#dealing-with-circular-type-inferenceActions | Convex Developer Hub
Call third-party services and external APIs from Convex
@erquhart could there be any other issue that causes this? I checked everywhere and made sure I'm not returning the value from
ctx.run*
Could it be an issue with my schema?How are you defining your schema? I ran into this using
Table
from convex-helpers
in individual schema.ts
files because I had circular references between these filesOh I'm using
defineTable
and defineSchema
Can't figure out this issue. I've used so many AI tokens alreadyTry building your schema up from the ground and seeing where things break. Like, comment out everything, and then re-introduce stuff table-by-table or file by file etc
Was hoping to avoid this, but looks like it's going to have to be done
For any one else who has this issue. I had a
migrations.ts
file that looks like this
After removing this file, the isse went away.I suspect that was a link in a chain and not the source of the problem, but yeah hard to see anything clearly with that type instantiation error. Did you have to drop the migrations component altogether or just alter your approach to using it?