#am-webhooks-cli

1 messages ยท Page 1 of 1 (latest)

crystal stratus
#

can you share a copy paste from your terminal CLI window to show me which events are triggered twice?

to clarify, you mentioned two distinct events in your msg above

elder trout
#

Yes, both events are triggered by my application and both events are duplicated.

#

2021-10-28 15:52:47 --> payment_intent.requires_action [evt_3JpZyEJk2S5ksjC91aOqgClG]
2021-10-28 15:52:47 --> connect payment_intent.requires_action [evt_3JpZyEJk2S5ksjC91aOqgClG]
2021-10-28 15:52:47 --> payment_intent.created [evt_3JpZyEJk2S5ksjC91G4yGiKI]
2021-10-28 15:52:47 --> connect payment_intent.created [evt_3JpZyEJk2S5ksjC91G4yGiKI]
2021-10-28 15:52:47 <-- [200] POST https://core.test/stripe/webhook [evt_3JpZyEJk2S5ksjC91aOqgClG]
2021-10-28 15:52:48 <-- [200] POST https://core.test/stripe/webhook [evt_3JpZyEJk2S5ksjC91aOqgClG]
2021-10-28 15:52:48 <-- [200] POST https://core.test/stripe/webhook [evt_3JpZyEJk2S5ksjC91G4yGiKI]
2021-10-28 15:52:48 <-- [200] POST https://core.test/stripe/webhook [evt_3JpZyEJk2S5ksjC91G4yGiKI]
2021-10-28 15:52:55 --> connect payment_intent.succeeded [evt_3JpZyEJk2S5ksjC91ZHbdjoN]
2021-10-28 15:52:55 --> payment_intent.succeeded [evt_3JpZyEJk2S5ksjC91ZHbdjoN]
2021-10-28 15:52:55 --> charge.succeeded [evt_3JpZyEJk2S5ksjC91zMmYZIZ]
2021-10-28 15:52:55 --> connect charge.succeeded [evt_3JpZyEJk2S5ksjC91zMmYZIZ]
2021-10-28 15:52:55 <-- [200] POST https://core.test/stripe/webhook [evt_3JpZyEJk2S5ksjC91ZHbdjoN]
2021-10-28 15:52:55 <-- [200] POST https://core.test/stripe/webhook [evt_3JpZyEJk2S5ksjC91ZHbdjoN]
2021-10-28 15:52:55 <-- [200] POST https://core.test/stripe/webhook [evt_3JpZyEJk2S5ksjC91zMmYZIZ]
2021-10-28 15:52:56 <-- [200] POST https://core.test/stripe/webhook [evt_3JpZyEJk2S5ksjC91zMmYZIZ]

elder trout
#

Any idea what could be causing this?

crystal stratus
#

looking

elder trout
#

๐Ÿ‘

crystal stratus
#

how did you run Stripe CLI? You're seeing "merchant" and "connect" events in your logs that is probably why you're seeing them twice

elder trout
#

I ran stripe login

#

then once logged in I ran stripe listen --forward-to my-app.url

#

Is that not the correct way to run stripe CLI?

crystal stratus
#

let me check something

crystal stratus
#

just to confirm, don't share the full url but I assume in that stripe listen command, the url you pass is webhooks.****.io/in/stripe?token*** right?
asking cause that url is the same endpoint for your account and connect webhooks
(don't have a full answer yet but piecing something together)

elder trout
elder trout
#

Any updates?

crystal stratus
#

asked a colleague about it to confirm something

#

as a repro, can you say create a Customer and show copy/paste the duplicate events you see coming in?

elder trout
#

2021-10-28 18:36:54 --> customer.created [evt_1JpcX4Jk2S5ksjC9yZcPBho2]
2021-10-28 18:36:54 --> connect customer.created [evt_1JpcX4Jk2S5ksjC9yZcPBho2]
2021-10-28 18:36:54 <-- [200] POST https://core.test/stripe/webhook [evt_1JpcX4Jk2S5ksjC9yZcPBho2]
2021-10-28 18:36:54 <-- [200] POST https://core.test/stripe/webhook [evt_1JpcX4Jk2S5ksjC9yZcPBho2]
2021-10-28 18:36:55 --> payment_method.attached [evt_1JpcX5Jk2S5ksjC9KVlDiHRz]
2021-10-28 18:36:55 --> connect payment_method.attached [evt_1JpcX5Jk2S5ksjC9KVlDiHRz]
2021-10-28 18:36:55 --> customer.source.created [evt_1JpcX5Jk2S5ksjC9o5JKFMaF]
2021-10-28 18:36:55 --> connect customer.source.created [evt_1JpcX5Jk2S5ksjC9o5JKFMaF]
2021-10-28 18:36:56 --> customer.updated [evt_1JpcX5Jk2S5ksjC9EVyjdv9l]
2021-10-28 18:36:56 --> connect customer.updated [evt_1JpcX5Jk2S5ksjC9EVyjdv9l]
2021-10-28 18:36:56 <-- [200] POST https://core.test/stripe/webhook [evt_1JpcX5Jk2S5ksjC9KVlDiHRz]
2021-10-28 18:36:56 <-- [200] POST https://core.test/stripe/webhook [evt_1JpcX5Jk2S5ksjC9KVlDiHRz]
2021-10-28 18:36:56 <-- [200] POST https://core.test/stripe/webhook [evt_1JpcX5Jk2S5ksjC9o5JKFMaF]
2021-10-28 18:36:56 <-- [200] POST https://core.test/stripe/webhook [evt_1JpcX5Jk2S5ksjC9o5JKFMaF]
2021-10-28 18:36:56 <-- [200] POST https://core.test/stripe/webhook [evt_1JpcX5Jk2S5ksjC9EVyjdv9l]
2021-10-28 18:36:56 <-- [200] POST https://core.test/stripe/webhook [evt_1JpcX5Jk2S5ksjC9EVyjdv9l]

white lark
#

๐Ÿ‘‹ Just hopping in since @crystal stratus had to step away - we think this is happening because you've connected your account to itself, so the events that are being sent to you both as the connected account, and as the platform

elder trout
#

Ok, well I am glad you have figured out what it could be. But I am not sure I understand what you mean. What would I have to do to fix this?

white lark
elder trout
#

What does it mean to connect the account to itself? And why is that even a feature? What was the intended use case for such a setting?

#

I'd like to avoid revoking that access as I don't know why it was setup, however the application url is for a completely separate marketing website that has no business logic attached to it. What makes you think that having an application authorised like that would duplicate the events? I don't see anywhere granting an application access can cause duplicate events. And I don't understand how it would even be possible when the application attached is a marketing website. I have just checked and the event payload has an idempotency_key but this is also identical with each event.

white lark
#

Let me clarify - granting an application access in general (like having account A connect to platform B) is not what is causing duplicate events. The duplicate events is happening specifically only because the account is connected to itself (platform/account B is connected to itself). When you run the stripe listen command you listen for any connect and non-connect webhooks for your account. When an event is triggered for the account, it is sent twice because as both a connect event (since the account is connected to itself) and a non-connect since it is also a standalone account.
Does that make sense?

elder trout
#

When you say connected to itself. Are you saying my stripe account is connected to itself? Or are you saying my application is connected to itself? Or something else? And what is a "connect" and "non-connect" webhook.

white lark
#

Just want to double check - when you say "Or are you saying my application is connected to itself? ", what are you referring to as the "application"

elder trout
#

My PHP app that I have connected to stripe via the test keys and secret. Is being run locally using the hostname core.test and is the app I am forwarding the stripe webhooks to using stripe cli tool.

crystal stratus
#

hello! catching up here again, one sec and have context

#

@elder trout so what is going on is, your Stripe account is a Platform. However, the same account is "self-connected" to itself. Meaning your Stripe Platform is a Connect account to itself

this is behavior that is blocked and no longer possible but yours happened before it was blocked, back in 2017

#

that is why when you make 1 event, you receive it twice, once as a regular "oh X event happened on this account"
and the second as "oh X event happened on this Connect account which is actually the same account"

#

the --forward-to flag sends both Connect events and events happening on the same account to an endpoint. You aren't doing anything with Connect, just that you have the unique situation where your account is a Platform to itself

elder trout
#

Ok, I think I understand a bit better. I have just tested by triggering an different type of event a "account.updated" event. The stripe cli logs show only the connect account.updated event. I.e this type of event is not duplicated. Does that help in any way?