#pedgo-webhooks

1 messages ยท Page 1 of 1 (latest)

split oar
#

Hey @latent fulcrum, there's two commands. The first is stripe listen localhost:3000/webhooks which creates a direct connection between Stripe and your local running server. The second is stripe trigger which will fire all the API calls required to result in a given event.

latent fulcrum
#

Don't I need the --forward-to flag?

split oar
#

sorry yeah you need that flag

latent fulcrum
#

So I need 2 terminals?

split oar
#

yes

latent fulcrum
#

oh

#

that makes sense

#

ty

split oar
#

my pleasure ๐Ÿ™‚

latent fulcrum
#

can you help me with one more thing?
I'm using docker to run the stripe CLI. Why won't it accept my --forward-to flag?
docker run --rm -it stripe/stripe-cli listen --forward-to localhost:4000/webhooks/stripe --api-key SECRET_TEST_KEY

split oar
#

What's the error?

#

I'm on a new machine and installing docker to test ๐Ÿ™‚

latent fulcrum
#

Oh, don't worry if that's too complicated. It was a problem about positional argument

split oar
#

ah nice

latent fulcrum
#

I managed to open a new cli and now it's working I think

split oar
#

sweet

latent fulcrum
#

thank you either way

split oar
#

happy to be a rubber duck ๐Ÿฆ†

latent fulcrum
#

haha

#

I'm sorry to bother you hat much but could you help me understanding why my webhooks are being refused even tho I can reach my server with Insomnia?

split oar
#

yeah

#

so you have stripe listen up and running?

#

and when you trigger, what is showing in the logs for listen as the response status code?

latent fulcrum
#
2022-01-15 20:45:12            [ERROR] Failed to POST: Post "http://localhost:4000/webhooks/stripe": dial tcp 127.0.0.1:4000: connect: connection refused```
#

It says it can't reach http://localhost:4000/webhooks/stripe, but when I do a Post request with Insomnia, I can reach it, it responds a 400 WARNING: Webhook signature verification failed!!! as it should

split oar
#

Okay, I'm a little ignorant about how host names work with docker, but i have a feeling that using localhost is attempting to use the docker container as the host?

latent fulcrum
#

oh

#

that's sounds correct

#

I'm too not that familiar with docker

split oar
#

Maybe try adding --network="host" to the docker run args?

latent fulcrum
#

gonna try

split oar
#

okay i'm seeing the same error you are now and am able to reproduce.

latent fulcrum
#

yeah, I tried multiple flags

#

none worked yet

#

Only discovered how to connect from outside to docker /:

split oar
#

okay

#

figured it out. it's weird...

#

host.docker.internal is the hostname of the host when communicating from the docker image to the host.

#

Here's my stripe listen command:

#
docker run --rm -it stripe/stripe-cli listen --forward-to host.docker.internal:4242/webhook --api-key sk_test_xxx
latent fulcrum
#

ok, you helped me a lot

split oar
#

This was confusing!

latent fulcrum
#

I was tying to use this command on the stripe listen command

split oar
#

I'm going to write a little blog post about this, I think.

latent fulcrum
#

didn't knew I had to set up directly on the docker command

latent fulcrum
latent fulcrum
split oar
#

OOC was there a reason you couldn't install the Stripe CLI directly?

#

and use without docker?

latent fulcrum
#

yeah, I use homebrew but stripe homebrew only works on mac according to some github issues I read. So my second option was docker

#

(And I'm on ubuntu)

split oar
#

gotcha.

latent fulcrum
#

I'm gonna try to fix the rest by myself, but just fyi. It ignores the path:
[ERROR] Failed to POST: Post "http://host.docker.internal:4000/webhooks/stripe": dial tcp 192.168.65.2:4000: connect: connection refused