#moha_code
1 messages ¡ Page 1 of 1 (latest)
đ 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/1289315930467205191
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Can you explain more about your problem here?
I believe you're using the --forward option here, and the 404 is a representation of your server response where you forwarded it
You should add some debugging to your server/endpoint to understand why it responded with 404
Thanks for getting back.
I am using --forward-to and my server return 200 status code.
INFO (94583): POST /api/v1/stripe/webhook/subscription 200 - Stripe/1.0 (+https://stripe.com/docs/webhooks) - anonymous
this is the general log of my server which I am running it locally.
using nestjs, and followed this:
https://github.com/stripe/stripe-node/blob/master/examples/webhook-signing/nestjs/app.controller.ts
So where does that 404 arise?
import {
Controller,
Headers,
Post,
RawBodyRequest,
Req,
Res,
} from '@nestjs/common';
import { Request, Response } from 'express';
import { StripeWebhookService } from '../services/stripe-webhook.service';
@Controller({
path: 'webhook',
version: '1',
})
export class StripeWebhookController {
constructor(private readonly stripeWebhookService: StripeWebhookService) {}
@Post('subscription')
async subscription(
@Headers('stripe-signature') sig: string,
@Req() req: RawBodyRequest<Request>,
@Res() res: Response,
) {
const rawBody = req['rawBody'];
console.log({ rawBody });
try {
const event = this.stripeWebhookService.constructEvent(rawBody, sig);
console.log({ event });
res.status(200).end();
} catch (err) {
console.error(`Webhook Error: ${err.message}`);
res.status(400).send(`Webhook Error: ${err.message}`);
}
}
}
With this, I am getting 404.
don't know
So you're getting the event at the expected local endpoint successfully? Thats good, at least