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

POST request getting refused from the Stripe CLI #1269

Open
ank-it07 opened this issue Oct 25, 2024 · 2 comments
Open

POST request getting refused from the Stripe CLI #1269

ank-it07 opened this issue Oct 25, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ank-it07
Copy link

The more information we have the easier it is for us to help. Feel free to remove any sections that might not apply

Issue

When attempting to trigger payment_intent.succeeded in the Stripe CLI, the following error occurs:
image
After reading related discussions, including PR #621, and testing all suggested solutions, the issue persists. The error seems related to the CLI failing to connect to the localhost endpoint.

Steps Taken

  1. Networking Suggestions:
    • Used 127.0.0.1 directly in web servers and instructed Stripe CLI to listen on 127.0.0.1.
    • Tried localhost with Stripe CLI set to listen on [::1] (IPv6 address).
  2. Command Modifications:
    • Explicitly added https:// in the Stripe CLI listen command, e.g., stripe listen --forward-to https://[::1]:3000/api/payment.
  3. Endpoint Verification:
    • Verified server endpoints and local listeners for correctness.
  4. Postman Request Test:
    • Sent a POST request from Postman to the endpoint and received a 200 OK response.

Expected Behavior

When triggering payment_intent.succeeded, the CLI should forward the event data to http://localhost:3000/api/payment and return a response.

Steps to reproduce

  1. spun the docker container following the reference https://docs.stripe.com/cli/docker
  2. also did the necessary port mapping to expose localhost.
  3. SSH into the container.
  4. stripe login
  5. triggered stripe trigger payment_intent.succeeded
  6. got the error

Traceback

Share any debug output that was given by the CLI

Environment

  • OS: Windows
  • Environment: Docker Container

Additional Context

I'm relatively new to using Stripe’s CLI, though I’ve covered most basics. I've tried to resolve the issue by troubleshooting various methods and configurations, but I still seem to be missing something critical. Any additional guidance would be greatly appreciated!

@ank-it07 ank-it07 added the bug Something isn't working label Oct 25, 2024
@StevenKhuu27
Copy link

Hey @ank-it07, I was having some issues with this as well but saw this.

The solution is to use host.docker.internal:3000/ instead of localhost:300, or at least this worked for me.

@ank-it07
Copy link
Author

ank-it07 commented Dec 9, 2024

Thanks for sharing @StevenKhuu27, It worked for me too! Appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants