Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error priceData #297

Open
guylepage3 opened this issue Feb 15, 2024 · 4 comments · May be fixed by #313
Open

Type error priceData #297

guylepage3 opened this issue Feb 15, 2024 · 4 comments · May be fixed by #313

Comments

@guylepage3
Copy link
Contributor

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.
@iancuandrei
Copy link

iancuandrei commented Feb 26, 2024

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

@guylepage3
Copy link
Contributor Author

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

@chriscarrollsmith
Copy link
Contributor

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 chriscarrollsmith linked a pull request Mar 11, 2024 that will close this issue
@amrawadk
Copy link

amrawadk commented Sep 7, 2024

FYI, for those that need a bit more guidance on how to drop the columns from supabase:

  1. create a new migration
supabase migration new remove_description_metadata_from_prices
  1. add the following SQL to the newly created migration file
ALTER TABLE prices
DROP COLUMN description,
DROP COLUMN metadata;
  1. apply the new migration
supabase db push
  1. regenerate the db types to pick up the new change
pnpm supabase:generate-types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants