Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhooks connection refused #621

Closed
alexandergavrailov opened this issue Apr 5, 2021 · 8 comments
Closed

Webhooks connection refused #621

alexandergavrailov opened this issue Apr 5, 2021 · 8 comments

Comments

@alexandergavrailov
Copy link

alexandergavrailov commented Apr 5, 2021

I'm constantly getting a connection refused error when trying to receive webhooks.

(venv) alexa@spacs-money:/etc/nginx/sites-available$ stripe listen --forward-to localhost:5000/webhook/
go package net: built with netgo build tag; using Go's DNS resolver
> Ready! Your webhook signing secret is whsec_************************* (^C to quit)
2021-04-05 18:13:03   --> customer.subscription.updated [evt_1Icwv5HrsuAsSZROjKy4Z5CK]
2021-04-05 18:13:03            [ERROR] Failed to POST: Post "http://localhost:5000/webhook/": dial tcp 127.0.0.1:5000: connect: connection refused)

The port is enabled through my firewall:

To                         Action      From
--                         ------      ----
5000                       ALLOW       Anywhere
5000/tcp                   ALLOW       Anywhere
22/tcp                     ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
5555                       ALLOW       Anywhere
5000 (v6)                  ALLOW       Anywhere (v6)
5000/tcp (v6)              ALLOW       Anywhere (v6)
22/tcp (v6)                ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)
5555 (v6)                  ALLOW       Anywhere (v6)

My webapp is running on Ubuntu 20.10

@tomer-stripe
Copy link
Collaborator

Hey @alexandergavrailov! That Failed to POST error is the CLI having problem making the POST request to your localhost app.

Does it work when you curl that localhost url?

@syslogic
Copy link

syslogic commented May 5, 2021

I think the --forward-to should not have the /webhook/ part.

@pepin-stripe
Copy link
Contributor

To reiterate with Tomer said, the issue here if the CLI having trouble sending a POST to your app's localhost:5000/webhook/ endpoint. You should make sure your app is running and this URL is valid.

You can try running curl -X POST localhost:5000/webhook/ to verify if the endpoint is valid.

I'm closing this due to lack of activity for >5months. Please reopen if you have more questions!

@saiivs
Copy link

saiivs commented Feb 10, 2023

Hey.
I'm facing the same issue mentioned above & I do tried to validate the endpoint by [curl -X POST localhost:5000/webhook], its working fine but the Stripe cli issue remains the same with a connection refuse log

@hmih
Copy link

hmih commented Jan 30, 2024

Same here

@cod1r
Copy link

cod1r commented Feb 13, 2024

I believe the issue is that for the hostname 'localhost', most software will now bind to the ipv6 address instead of the ipv4. So mapping 127.0.0.1 to localhost won't work.

The fix is either to use 127.0.0.1 directly in your web servers and tell the stripe cli to listen for 127.0.0.1 or to use 'localhost' and tell the stripe cli to listen for [::1] which is the ipv6 address.

Ex:

stripe listen --forward-to [::1]:<port>/webhook

It's a weird situation for me because I assumed that localhost would work for both ipv6 and ipv4 automatically but I guess not...

@jdbohrman
Copy link

@cod1r It's pretty abysmal that Stripe hasn't addressed that tbh.

@klortiz13
Copy link

I was getting EOF errors until I explicitly wrote https:// in the stripe listen command:
stripe listen --forward-to https://[::1]:<port>/webhook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants