#izzy_webhooks

1 messages ¡ Page 1 of 1 (latest)

pulsar lagoonBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1353816949527941212

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

dry scaffold
#

Hello there

shrewd swift
#

hey

dry scaffold
#

So you are running your server and attempting to forward Events to your local endpoint using the Stripe CLI?

shrewd swift
#

currently yeah, i noticed the problem because i had deployed it to my dev env and when i checked the webhook events they kept returning that they've failed and 500

#

so i tried rerunning the cli and that also keeps giving me the same type of error

dry scaffold
#

That 500 is coming from your server so that is where you need to debug.

#

So the first thing to figure out is whether the webhook is hitting your endpoint at all.

#

And to check your server logs for any sort of information/error as well.

shrewd swift
#

it isn't, i tried setting up a breakpoint in the controller
this is the CLI issued secret
[HttpPost("webhook")]
public async Task<IActionResult> SubscriptionWebhook()
{
var requestBody = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();
var stripeEvent = EventUtility.ConstructEvent(
requestBody,
Request.Headers["Stripe-Signature"],
configuration["whsec_340855c6c551a0a490aa9b48be44b19dd0e716b8c426b677b247abd8ead5f192"],
throwOnApiVersionMismatch: false
);

        await subscriptionService.SubscriptionWebhook(stripeEvent);
        return Ok();
    }

(that's the secret from the CLI)

#

it doesnt even enter it at all

#

so no, it's not hitting the EP

#

unfortunately there's no internal logging system so i can't check anything additional

dry scaffold
#

What is the exact command you are using with the CLI?

shrewd swift
#

this is the rest of the method on the BE

    public async Task SubscriptionWebhook(Event request)
    {
        if(request.Type == EventTypes.InvoicePaymentSucceeded)
        {
            var invoice = request.Data.Object as Invoice;
            var customerId = invoice.CustomerId;

            var subscription = await subscriptionRepository.GetSubscriptionByCustomerId(new StringRequest(customerId));
            subscription.Type = SubscriptionTypeEnum.Basic;
            await subscriptionRepository.UpdateAsync(subscription);
        }
    }
#

but again it doesnt even get there

dry scaffold
#

Can you hit that endpoint via your frontend?

#

Overall I can't help much here... you are going to have to debug your server endpoint and ensure it is accessible.

shrewd swift
#

the thing is it's a monolith architecture system, this EP only exists on the BE it's not currently even registered on the FE
do you think the disconnect might be the issue?

dry scaffold
#

What do you mean by "the disconnect"?

#

Really the frontend piece would have just been to test to ensure the endpoint is set up correctly.

#

But that's not a necessary thing here in terms of the Webhook being delivered.

shrewd swift
#

i mean, do i have to register that EP on the frontend for it to reach the backend at all? since it's a webhook i don't know if that would be necessary?

dry scaffold
#

What's happening right now is you are triggering an Event which attempts a POST request to your specified endpoint but before reaching that endpoint your server is erroring and returning a 500.

#

No, that's not necessary.

#

You need to step through from the initial ingress point of your server to wherever this endpoint lives

#

And figure out where this 500 error is coming from.

shrewd swift
#

alright..i'll try that and then i guess i'll try getting in touch again if there's some progress

dry scaffold
#

Sounds good. We are happy to help but since we don't have any insight into your server there isn't too much we can do in this case.