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

Add script to seed stripe products and prices

Open ChrisGambrell opened this issue 1 year ago • 3 comments

This change adds a script to seed products and prices from Stripe.

This change will benefits developers working in a shared development environment by allowing them to work with the same products and prices.

The script is ran with the following command: pnpm stripe:seed.

ChrisGambrell avatar Mar 26 '24 17:03 ChrisGambrell

@ChrisGambrell is attempting to deploy a commit to the Vercel Solutions Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Mar 26 '24 17:03 vercel[bot]

Hi @ChrisGambrell that is a useful addon. How would you trigger script execution? I don't see an updated package.json to include the stripe:seed command, so this command is not found.

I tried with npx ts-node scripts/seed-stripe.ts, but this results in: Error: Cannot find module 'tsconfig-paths/register'. Then I pnpm install -D tsconfig-paths, which allowed ts-node to run, but I get error: if (!supabaseUrl) throw new Error('supabaseUrl is required.') Error: supabaseUrl is required.

Update: so I guess I got it now with: npx ts-node -r scripts/dotenv.config.ts scripts/seed-stripe.ts

olivernettinger avatar Apr 05 '24 02:04 olivernettinger

Hi @ChrisGambrell that is a useful addon. How would you trigger script execution? I don't see an updated package.json to include the stripe:seed command, so this command is not found.

I tried with npx ts-node scripts/seed-stripe.ts, but this results in: Error: Cannot find module 'tsconfig-paths/register'. Then I pnpm install -D tsconfig-paths, which allowed ts-node to run, but I get error: if (!supabaseUrl) throw new Error('supabaseUrl is required.') Error: supabaseUrl is required.

Update: so I guess I got it now with: npx ts-node -r scripts/dotenv.config.ts scripts/seed-stripe.ts

Apologies- I forgot to include the command to run! This should be updated now. You can seed products and prices from stripe with the command pnpm stripe:seed

ChrisGambrell avatar Apr 09 '24 14:04 ChrisGambrell