stripe-cli: "Failed to connect to Stripe" when running "stripe listen"

Issue

After following the instructions to run stripe webhooks locally, I’m not able to get past “Getting ready…”. I’m not behind a company firewall or proxy.

instructions I followed: https://stripe.com/docs/stripe-cli

Expected Behavior

It should start listening for events that get triggered via stripe trigger payment_intent.succeeded as mentioned in the instructions

Steps to reproduce

  1. Download stripe-cli via homebrew link
  2. brew install stripe/stripe-cli/stripe
  3. login in terminal via stripe login
  4. run local webhook express server file (named server.js) using the example code via node server.js
  5. run stripe listen command using stripe listen --forward-to localhost:4242/webhook (I added --log-level=debug to show the issue that’s happening)

Traceback

stripe listen --forward-to localhost:8080/webhooks/stripe --log-level=debug 

⣾ Getting ready... [Wed, 13 Apr 2022 15:35:03 PDT] DEBUG stripeauth.client.Authorize: Authenticating with Stripe...
⣯ Getting ready... [Wed, 13 Apr 2022 15:35:14 PDT] DEBUG stripeauth.Client.Authorize: Got successful response from Stripe default_version=2020-08-27 display_connect_filter_warning=false latest_version=2020-08-27 reconnect_delay=248 websocket_authorized_feature=webhook-payloads websocket_id=cliws_{5086}_O2nivhb4Ef3xOeEg8lMlCMPl0uOY3AloXNXYOsJ8Rp3Pf1QnHW websocket_url=wss://stripe-cli.stripe.com/subscribe/acct_1KUgMLJYMOMTx4nT
[Wed, 13 Apr 2022 15:35:14 PDT] DEBUG websocket.client.Run: Attempting to connect to Stripe
[Wed, 13 Apr 2022 15:35:14 PDT] DEBUG websocket.Client.connect: Dialing websocket url=wss://stripe-cli.stripe.com/subscribe/acct_1KUgMLJYMOMTx4nT?websocket_feature=webhook-payloads
⣽ Getting ready... [Wed, 13 Apr 2022 15:35:24 PDT] DEBUG websocket.Client.connect: Websocket connection error error=dial tcp: i/o timeout message=
[Wed, 13 Apr 2022 15:35:24 PDT] DEBUG websocket.client.Run: Failed to connect to Stripe. Retrying...
⢿ Getting ready... [Wed, 13 Apr 2022 15:35:34 PDT] DEBUG websocket.Client.connect: Dialing websocket url=wss://stripe-cli.stripe.com/subscribe/acct_1KUgMLJYMOMTx4nT?websocket_feature=webhook-payloads
⣟ Getting ready... ^C[Wed, 13 Apr 2022 15:35:36 PDT] DEBUG proxy.Proxy.Run: Ctrl+C received, cleaning up...
[Wed, 13 Apr 2022 15:35:36 PDT] DEBUG websocket.Client.connect: Websocket connection error error=dial tcp: operation was canceled message=
[Wed, 13 Apr 2022 15:35:36 PDT] DEBUG websocket.client.Run: Failed to connect to Stripe. Retrying...
[Wed, 13 Apr 2022 15:35:36 PDT] DEBUG websocket.Client.connect: Dialing websocket url=wss://stripe-cli.stripe.com/subscribe/acct_1KUgMLJYMOMTx4nT?websocket_feature=webhook-payloads
[Wed, 13 Apr 2022 15:35:36 PDT] DEBUG websocket.Client.connect: Websocket connection error error=dial tcp: operation was canceled message=

Environment

macOS - m1 chip

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 18 (2 by maintainers)

Most upvoted comments

I just experienced this issue on my M1 Mac and burned about 3 hours troubleshooting it 😅

Same as a lot of the previous comments here: websockets worked fine in general, no connection issues to other services. --no-wss did not help, clearing my network DNS did not help, adding new DNS servers to my WiFi router did not help…BUT I was able to get stripe listen up and running by adding Cloudflare’s DNS server (1.1.1.1) directly to my DNS settings for my WiFi connection in System Preferences > Network > WiFi > Advanced > DNS.

There seem to be several people experiencing this issue - found the fix that finally worked in recent comments on an old closed issue #359 .

I just experienced this issue on my M1 Mac and burned about 3 hours troubleshooting it 😅

Same as a lot of the previous comments here: websockets worked fine in general, no connection issues to other services. --no-wss did not help, clearing my network DNS did not help, adding new DNS servers to my WiFi router did not help…BUT I was able to get stripe listen up and running by adding Cloudflare’s DNS server (1.1.1.1) directly to my DNS settings for my WiFi connection in System Preferences > Network > WiFi > Advanced > DNS.

There seem to be several people experiencing this issue - found the fix that finally worked in recent comments on an old closed issue #359 .

You saved my day, thank you!