Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

3. Seeding your Stripe account step failed #457

@ogawa5773

Description

@ogawa5773

What is happening

Follow the README and in the step "3. Seeding your Stripe account" I got an error like below

Error in script: Cannot find module '/Users/xxx/redwood/example-store-stripe/api/src/lib/stripe'
Require stack:
- /Users/xxx/example-store-stripe/scripts/seed-stripe.js
- /Users/xxx/example-store-stripe/node_modules/@redwoodjs/cli/dist/lib/exec.js
- /Users/xxx/example-store-stripe/node_modules/@redwoodjs/cli/dist/commands/execHandler.js
[FAILED] Cannot find module '/Users/xxx/example-store-stripe/api/src/lib/stripe'
[FAILED] Require stack:
[FAILED] - /Users/xxx/example-store-stripe/scripts/seed-stripe.js
[FAILED] - /Users/xxx/example-store-stripe/node_modules/@redwoodjs/cli/dist/lib/exec.js
[FAILED] - /Users/xxx/example-store-stripe/node_modules/@redwoodjs/cli/dist/commands/execHandler.js
The script exited with errors.

My Solution

I was able to proceed without any problems by revert the following commit

commit 822e875fb62649dc2df29553fa2b768dfb33e0ee (origin/tmp)
...
diff --git a/api/src/lib/stripe.js b/api/src/lib/stripe.js
deleted file mode 100644
index 78d89c9..0000000
--- a/api/src/lib/stripe.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import Stripe from 'stripe'
-
-export const stripe = new Stripe(process.env.STRIPE_SK)
-
-export const handleStripeWebhooks = (event, context, webhooksObj) => {
-  let stripeEvent
-  try {
-    const sig = event.headers['stripe-signature']
-    stripeEvent = stripe.webhooks.constructEvent(
-      event.body,
-      sig,
-      process.env.STRIPE_WEBHOOK_SK
-    )
-
-    let results = null
-    if (typeof webhooksObj[stripeEvent.type] !== 'undefined') {
-      results = webhooksObj[stripeEvent.type](event, context)
-    }
-    return results
-  } catch (error) {
-    console.log(error)
-    throw error
-  }
-}

Question

Is this an intentional file deletion or a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions