stripe-cli icon indicating copy to clipboard operation
stripe-cli copied to clipboard

Cannot test connect webhook events using local listener

Open lenardchristopher opened this issue 1 year ago • 1 comments

Issue

I am trying to debug some failing connect events using the webhook local listener.

Expected Behavior

When running the listener, I expect Stripe to forward events to my local webhook. This expected behavior is how I'm reading the Stripe documentation here.

Optionally, if you’ve already registered your endpoint in Stripe, use the --load-from-webhooks-api and --forward-to flags.

stripe listen --load-from-webhooks-api --forward-to localhost:5000

This command forwards events sent to your Stripe-registered public webhook endpoint to your local webhook endpoint. It loads your registered endpoint, parses the path and its registered events, then appends the path to your local webhook endpoint in the --forward-to path. If you’re checking webhook signatures, use the {{WEBHOOK_SIGNING_SECRET}} from the initial output of the listen command.

Steps to reproduce

  1. Setup a connect webhook in Stripe. Something like this Screenshot 2023-06-25 at 2 39 20 PM

  2. Run a webhook handler locally (for me, localhost:7185)

  3. In a terminal, run stripe listen --load-from-webhooks-api --forward-to localhost:7185 --forward-connect-to localhost:7185. Observe the listener in active in Stripe Dashboard.

  4. Create and confirm a payment intent for a connect account using Stripe API in order to trigger payment_intent.succeeded event

  5. Observe that an event is recorded for the webhook in Stripe Dashboard, but no event triggers for the Stripe CLI listener.

Traceback

None

Environment

macOS

lenardchristopher avatar Jun 25 '23 18:06 lenardchristopher

I had the same issue, that "real" webhook calls for events (triggered during the test checkout process on a local dev machine) was not forwarded back to the local machine. The missing part for me was --forward-connect-to localhost:1234! After adding that to CLI startup, the local webhook handler are called now.

Moongazer avatar Jan 24 '24 21:01 Moongazer