Property 'stripeCustomerId' does not exist

Version: ^1.3.7-beta.4 I've loaded better-auth and @better-auth/stripe but keep getting this issue, not sure why...
src/integrations/trpc/routers/user.ts:23:23 - error TS2339: Property 'stripeCustomerId' does not exist on type '{ id: string; email: string; emailVerified: boolean; name: string; createdAt: Date; updatedAt: Date; image?: string | null | undefined; isAnonymous?: boolean | null | undefined; banned: boolean | ... 1 more ... | undefined; role?: string | ... 1 more ... | undefined; banReason?: string | ... 1 more ... | undefined; ...'.

23 if (!ctx.user.stripeCustomerId) {
~~~~~~~~~~~~~~~~

src/integrations/trpc/routers/user.ts:36:32 - error TS2339: Property 'stripeCustomerId' does not exist on type '{ id: string; email: string; emailVerified: boolean; name: string; createdAt: Date; updatedAt: Date; image?: string | null | undefined; isAnonymous?: boolean | null | undefined; banned: boolean | ... 1 more ... | undefined; role?: string | ... 1 more ... | undefined; banReason?: string | ... 1 more ... | undefined; ...'.

36 customer: ctx.user.stripeCustomerId,
~~~~~~~~~~~~~~~~

src/integrations/trpc/routers/user.ts:60:36 - error TS2339: Property 'stripeCustomerId' does not exist on type '{ id: string; email: string; emailVerified: boolean; name: string; createdAt: Date; updatedAt: Date; image?: string | null | undefined; isAnonymous?: boolean | null | undefined; banned: boolean | ... 1 more ... | undefined; role?: string | ... 1 more ... | undefined; banReason?: string | ... 1 more ... | undefined; ...'.

60 stripeCustomerId: ctx.user.stripeCustomerId,
~~~~~~~~~~~~~~~~
src/integrations/trpc/routers/user.ts:23:23 - error TS2339: Property 'stripeCustomerId' does not exist on type '{ id: string; email: string; emailVerified: boolean; name: string; createdAt: Date; updatedAt: Date; image?: string | null | undefined; isAnonymous?: boolean | null | undefined; banned: boolean | ... 1 more ... | undefined; role?: string | ... 1 more ... | undefined; banReason?: string | ... 1 more ... | undefined; ...'.

23 if (!ctx.user.stripeCustomerId) {
~~~~~~~~~~~~~~~~

src/integrations/trpc/routers/user.ts:36:32 - error TS2339: Property 'stripeCustomerId' does not exist on type '{ id: string; email: string; emailVerified: boolean; name: string; createdAt: Date; updatedAt: Date; image?: string | null | undefined; isAnonymous?: boolean | null | undefined; banned: boolean | ... 1 more ... | undefined; role?: string | ... 1 more ... | undefined; banReason?: string | ... 1 more ... | undefined; ...'.

36 customer: ctx.user.stripeCustomerId,
~~~~~~~~~~~~~~~~

src/integrations/trpc/routers/user.ts:60:36 - error TS2339: Property 'stripeCustomerId' does not exist on type '{ id: string; email: string; emailVerified: boolean; name: string; createdAt: Date; updatedAt: Date; image?: string | null | undefined; isAnonymous?: boolean | null | undefined; banned: boolean | ... 1 more ... | undefined; role?: string | ... 1 more ... | undefined; banReason?: string | ... 1 more ... | undefined; ...'.

60 stripeCustomerId: ctx.user.stripeCustomerId,
~~~~~~~~~~~~~~~~
24 Replies
Ping
Ping•3mo ago
Can I see ur full auth config?
sneakyf1shy
sneakyf1shyOP•3mo ago
bit of a mess but:
sneakyf1shy
sneakyf1shyOP•3mo ago
sneakyf1shy
sneakyf1shyOP•3mo ago
any ideas here? this mysterious issue is the main type issue left in my migration 😅
Ping
Ping•3mo ago
Are you working in a monorepo project?
sneakyf1shy
sneakyf1shyOP•3mo ago
yeah this has happened since i moved into a monorepo
Ping
Ping•3mo ago
I've seen something similar where larger auth configs will cause typescript to cut inference after a certain depth of a given type, so when shared across packages in a monorepo you'll see incorrect type inference just because TS has just cut those types off
sneakyf1shy
sneakyf1shyOP•3mo ago
however better-auth and all places that I consume auth types are all contained within one tanstack start project so not sure
Ping
Ping•3mo ago
(not sure if it's related)
sneakyf1shy
sneakyf1shyOP•3mo ago
yeah i saw this with my AI sdk stuff so I had to change to using tsc and project references but i don’t think that might be the case here, since the better auth types aren’t shared cross package it specifically seems like the stripe type just isn’t registering very weird
Ping
Ping•3mo ago
Okay I see, so your auth is in the same place where your trpc routes are defined?
sneakyf1shy
sneakyf1shyOP•3mo ago
Yeah
Ping
Ping•3mo ago
If you were to just make a fake (for testing purposes) new auth instance, and then only include the stripe plugin and pass that to trpc's context thing, see if that will still cause that type issue
sneakyf1shy
sneakyf1shyOP•3mo ago
hmm, okay currently am on mobile though will try this in a few hours and get back to you
sneakyf1shy
sneakyf1shyOP•3mo ago
No description
sneakyf1shy
sneakyf1shyOP•3mo ago
ignoring the cursor tab prediction, it doesn't seem to work
sneakyf1shy
sneakyf1shyOP•3mo ago
looks reproducable in a new project folder
No description
sneakyf1shy
sneakyf1shyOP•3mo ago
it looks like it started in 1.3.7 ? doesn't seem to happen on 1.3.6 I think this is an internal deps issue ok no theres more to it 1.3.7-beta.2 works but 1.3.7 doesn't
thines
thines•2mo ago
hello there, did you manage to dig this one out?
Ernest
Ernest•2mo ago
I'm experiencing a similar issue. Users who log in with Google receive an error when createCustomerOnSignUp is set to true (which is connected to stripeCustomerId). Downgrading to version 1.3.6 resolved the issue.
sebastian
sebastian•2mo ago
this missing stripe property issue has been pretty annoying. you can kind of skip the check by manually adding the custom (stripecustomerid) fields to your auth config if you want to use the newer versions. id really like to see this fixed tho, since the newer versions just started causing it. has a gh issue been created for this yet? also i've tested receiving the cus id with the type error and it fetched an actual cus id so that's probably a ts issue only Also the problem still occurs for me even when the instance is just the plugin and basic auth config
Ernest
Ernest•2mo ago
GitHub
fix(stripe): onCustomerCreate should be called even if update user ...
Summary by cubic Guarantees Stripe onCustomerCreate runs after customer creation, even if updateUser returns nothing. The callback now receives the user with stripeCustomerId included. Bug Fixes ...
sebastian
sebastian•4w ago
the type issue is still occuring unfortunately, tried both in beta and newest version :(
Duki
Duki•4d ago
I am still experiencing this issue in v 1.3.27 🤔 is it now necessary to add these fields manually into the user.additionalFields config?

Did you find this page helpful?