Joshowaaah!J
Convex Community4mo ago
2 replies
Joshowaaah!

Very Fun Instance of Type instantiation is excessively deep and possibly infinite.ts(2589)

Encountering this error, the following is what I have done to try to resolve it.


I have read this:

https://docs.convex.dev/functions/actions#dealing-with-circular-type-inference

so I ensured every single query, action, and mutation, internal ones too, have both a returns, and a typed return for the handler. EX

export const meFromIntegration = query({
    args: { integrationId: v.string() },
    returns: v.union(
        v.object({
            name: v.optional(v.string()),
            email: v.optional(v.string()),
            image: v.optional(v.string()),
            timezone: v.optional(v.string()),
            languageCode: v.optional(v.string()),
        }),
        v.null(),
    ),
    handler: async (
        ctx,
        args,
    ): Promise<{
        name: string;
        email: string;
        image: string;
        timezone: string;
        languageCode: LanguageCode;
    } | null> => {


didnt fix it.

So I kept looking around at other threads. Saw one mentioning it could have to do with Doc<>, so I removed all instances of Doc. Okay, Not it.

Also found something referencing v.any(), so now I dont use v.any(), no dice.

Okay so it said it had to do with ctx.run* not having a type. So I commented out every instance of ctx.run*, runMutation, runQuery, whatever. Still Not it.

No idea whats left to try.
Was this page helpful?