Error fetching subscription from Stripe
I have this code
that generates this error :
const checkout = async () => {
const { data, error } = await client.subscription.upgrade({
plan: 'pro',
successUrl: '/settings/billing',
cancelUrl: '/settings/billing'
})
}const checkout = async () => {
const { data, error } = await client.subscription.upgrade({
plan: 'pro',
successUrl: '/settings/billing',
cancelUrl: '/settings/billing'
})
}that generates this error :
ERROR [Better Auth]: Error fetching subscription from Stripe
Invalid prisma.subscription.update() invocation:
{
where: {
referenceId: "k8OMNp7UCEKPycrv5lvvrgBi7Wgdix7P",
? id?: String,
? AND?: SubscriptionWhereInput | SubscriptionWhereInput[],
? OR?: SubscriptionWhereInput[],
? NOT?: SubscriptionWhereInput | SubscriptionWhereInput[],
? plan?: StringFilter | String,
? stripeCustomerId?: StringNullableFilter | String | Null,
? stripeSubscriptionId?: StringNullableFilter | String | Null,
? status?: StringNullableFilter | String | Null,
? periodStart?: DateTimeNullableFilter | DateTime | Null,
? periodEnd?: DateTimeNullableFilter | DateTime | Null,
? cancelAtPeriodEnd?: BoolNullableFilter | Boolean | Null,
? seats?: IntNullableFilter | Int | Null
},
data: {
plan: "pro",
stripeSubscriptionId: "sub_1234",
status: "active",
periodStart: new Date("2025-03-07T13:51:40.000Z"),
periodEnd: new Date("2025-04-07T13:51:40.000Z"),
seats: 1
}
}
Argument where of type SubscriptionWhereUniqueInput needs at least one of id arguments. Available options are marked with ?.ERROR [Better Auth]: Error fetching subscription from Stripe
Invalid prisma.subscription.update() invocation:
{
where: {
referenceId: "k8OMNp7UCEKPycrv5lvvrgBi7Wgdix7P",
? id?: String,
? AND?: SubscriptionWhereInput | SubscriptionWhereInput[],
? OR?: SubscriptionWhereInput[],
? NOT?: SubscriptionWhereInput | SubscriptionWhereInput[],
? plan?: StringFilter | String,
? stripeCustomerId?: StringNullableFilter | String | Null,
? stripeSubscriptionId?: StringNullableFilter | String | Null,
? status?: StringNullableFilter | String | Null,
? periodStart?: DateTimeNullableFilter | DateTime | Null,
? periodEnd?: DateTimeNullableFilter | DateTime | Null,
? cancelAtPeriodEnd?: BoolNullableFilter | Boolean | Null,
? seats?: IntNullableFilter | Int | Null
},
data: {
plan: "pro",
stripeSubscriptionId: "sub_1234",
status: "active",
periodStart: new Date("2025-03-07T13:51:40.000Z"),
periodEnd: new Date("2025-04-07T13:51:40.000Z"),
seats: 1
}
}
Argument where of type SubscriptionWhereUniqueInput needs at least one of id arguments. Available options are marked with ?.