nextjs-subscription-payments icon indicating copy to clipboard operation
nextjs-subscription-payments copied to clipboard

Type error `priceData`

Open guylepage3 opened this issue 1 year ago • 4 comments

Nice work on the update. Thank you.

One error that I am sure everyone is getting is a type error seen below. Someone should update this at some point. Thx.

2.217    ▲ Next.js 14.1.0
2.217    - Environments: .env.local
2.218 
2.232    Creating an optimized production build ...
19.52  ✓ Compiled successfully
19.52    Linting and checking validity of types ...
23.87 Failed to compile.
23.87 
23.87 ./utils/supabase/admin.ts:43:9
23.87 Type error: Type '{ id: string; product_id: string; active: boolean; currency: string; type: Type; unit_amount: number | null; interval: Interval | null; interval_count: number | null; trial_period_days: number; }' is missing the following properties from type '{ active: boolean | null; currency: string | null; description: string | null; id: string; interval: "day" | "week" | "month" | "year" | null; interval_count: number | null; metadata: Json; product_id: string | null; trial_period_days: number | null; type: "one_time" | ... 1 more ... | null; unit_amount: number | nu...': description, metadata
23.87 
23.87   41 |   maxRetries = 3
23.87   42 | ) => {
23.87 > 43 |   const priceData: Price = {
23.87      |         ^
23.87   44 |     id: price.id,
23.87   45 |     product_id: typeof price.product === 'string' ? price.product : '',
23.87   46 |     active: price.active,
23.90  ELIFECYCLE  Command failed with exit code 1.

guylepage3 avatar Feb 15 '24 20:02 guylepage3

Hi! I'm getting the same error, did you manage to fix it?

iancuandrei avatar Feb 26 '24 18:02 iancuandrei

@iancuandrei If I remember correctly, I just updated my types.

guylepage3 avatar Feb 26 '24 19:02 guylepage3

I had dropped the 'description' and 'metadata' columns from the database schema in a PR and changed the types accordingly, because these are no longer really used by Stripe. The schema changes got rejected, but the types didn't get changed back.

You can run pnpm supabase:generate-types as a workaround to correct the issue until it's fixed.

chriscarrollsmith avatar Mar 10 '24 03:03 chriscarrollsmith