AutumnA
Autumn2mo ago
6 replies
Cristian Sotomayor

I everyone, I have a question with this

I everyone, I have a question with this implementation. Because I'm getting some errors trying to call autumm.check because it's a convex mutation

import { autumn } from './autumn';

export const create = mutation({
    args: {
        name: v.string(),
        description: v.optional(v.string()),
        type: v.optional(v.union(v.literal("group"), v.literal("channel"))),
        isPrivate: v.optional(v.boolean()),
    },
    handler: async (ctx, args) => {
        const identity = await ctx.auth.getUserIdentity();
        if (!identity) {
            throw new Error("Not authenticated");
        }

        // Check channel limit using Autumn
        const checkResult = await autumn.check(ctx, {
            featureId: CHANNEL_FEATURE_ID,
        });
        console.log('checkResult', checkResult);
        
        if (!checkResult.data) {
            throw new Error("Error checking channel limit");
        }

        if (!checkResult.data.allowed && !checkResult.data.unlimited) {
            throw new Error(
                "Channel limit reached. Upgrade to Pro to create unlimited channels.",
            );
        }


Because according to the guide, I should use import { autumn } from "convex/autumn"; but the convex/autumn path doesn't exists on my current project. The convex version that I'm using is: convex: ^1.27.0
image.png
Was this page helpful?