#Stripe Webhooks Changed API Key

1 messages · Page 1 of 1 (latest)

leaden leaf
#

Hmm that's a good question. Unfortunately I think you'll have to change the ID wherever you define the Stripe integration:

const stripe = new Stripe({ id: "new-id", ...);

#

I can delete the old integration id for you.

#

Sorry this isn't great. We're making this work differently for v3 because it's one of those things that seemed like a great idea at the time.

You'll connect the actual webhooks to your task in the UI in v3, though we haven't built that yet.

#

I haven't forgotten about you btw, just had a customer call but going to dish out v3 invites now

#

In fact I think I already enabled it for you before my call, I just need to message you

#

You have 2 options at the moment:

  1. Use v2 to add the Stripe webhooks
  2. Receive the webhooks to your normal backend (e.g. API route in Next.js) and then trigger a v3 task with the data.
#

Nope, you just create a new project and choose v3 from the dropdown

#

I'm currently writing a v2/v3 migration guide which I'll share in the #general channel when it's done. It'll be really helpful for people who are experienced with v2 like you.

#

Sorry I meant to say v3 in point 2 above

#

Sorry I'm being slow, explain more what you mean about the Stripe integration?

#

Ok I understand. So for now you should stick with those in v2 because we don't have webhook triggers for v3 yet.

We won't have webhook tasks this month, I think that'll be in May. Stripe will be the first one we do though because we use it ourselves extensively to do exactly the same stuff as you do.

#

But you can use v3 for other things you need.

#

And when the time comes we'll make it easy to move across.

#

Do you have any waits in your Stripe jobs?

#

Ok good, that'll make it easier to migrate when the time comes

#

Yes, what was the id for your Stripe integration before?

#

😆 makes sense

#

OK I've renamed it to "stripe-old". When you create the new one it should link your new "stripe" one to your Jobs. And then I can delete it.

#

It wouldn't let me delete it because it's linked to Jobs

#

Just run the CLI dev command I think

#

With the new API key set in your environment variables

#

But yeah you will need to deploy as well and then re-index

#

Yeah let's do that. We'll get v3 webhooks out soon so this won't be around for long

#

The steps should be:

  1. Deploy the code
  2. Re-index by going to the "Environments & API Keys" page, select the environment, then press Refresh
#

Annoyingly the External triggers page doesn't scroll with the UI update we made. I don't think I had as many webhooks as you

#

We'll get that fixed tomorrow

#

Hmm it's strange because I can see "stripe-new" has registered for DEV, but it's not in the list for Staging or Prod

#

I'll look at the indexing data.

#

It's strange because in the data when the Refresh button is pressed this is coming through:

{
      "key": "stripe.webhook-http-stripe.webhook-stripe",
      "params": {
        "events": ["price.created", "price.updated", "price.deleted"]
      },
      "channel": "HTTP",
      "options": {
        "event": [
          "price.created",
          "price.updated",
          "price.deleted",
          "product.created",
          "product.updated",
          "product.deleted",
          "checkout.session.completed",
          "customer.subscription.created",
          "customer.subscription.updated",
          "customer.subscription.deleted",
          "invoice.paid",
          "invoice.created"
        ]
      },
      "version": "2",
      "integration": {
        "id": "stripe",
        "metadata": { "id": "stripe", "name": "Stripe" },
        "authSource": "LOCAL"
      },
      "registerSourceJob": {
        "id": "stripe.webhook-http-stripe.webhook-stripe",
        "version": "0.1.0"
      }
    }
#

Note this bit:

"integration": {
  "id": "stripe",
  "metadata": { "id": "stripe", "name": "Stripe" },
  "authSource": "LOCAL"
},
#

It's the wrong ID

#

That's us calling your server on Vercel and what it's responding with.

#

Btw I'm not saying you've done anything wrong here. This has happened before with Vercel's builds having some crazy caching on them.

#

Can you do a full rebuild with no cache? There's a way to do it in the Vercel dashboard

#

(This is part of the reason we built v3 btw, there are so many problems when we have to talk to user's servers to register jobs/triggers etc. All the providers and frameworks have different quirks).

#

I'm going to go get the train but I'll be back online in 10 mins