-
Notifications
You must be signed in to change notification settings - Fork 942
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
Update docs for next.js 13/14 route handlers. #3731
Comments
Referring to https://www.remotion.dev/docs/lambda/webhooks |
Is someone with Next.js knowledge able to help and rewrite this for the App Router?
import {
validateWebhookSignature,
WebhookPayload,
} from "@remotion/lambda/client";
// Enable testing through the tool below
const ENABLE_TESTING = true;
export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
) {
if (ENABLE_TESTING) {
res.setHeader("Access-Control-Allow-Origin", "https://www.remotion.dev");
res.setHeader("Access-Control-Allow-Methods", "OPTIONS,POST");
res.setHeader(
"Access-Control-Allow-Headers",
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-Remotion-Status, X-Remotion-Signature, X-Remotion-Mode",
);
}
if (req.method === "OPTIONS") {
res.status(200).end();
return;
}
validateWebhookSignature({
secret: process.env.WEBHOOK_SECRET as string,
body: req.body,
signatureHeader: req.headers["x-remotion-signature"] as string,
});
// If code reaches this path, the webhook is authentic.
const payload = req.body as WebhookPayload;
if (payload.type === "success") {
// ...
} else if (payload.type === "timeout") {
// ...
}
res.status(200).json({
success: true,
});
} Don't try submit a ChatGPT solution, it is not correct! /bounty 60 |
💎 $60 bounty • RemotionSteps to solve:
Thank you for contributing to remotion-dev/remotion! |
@Idan-Garay: The Remotion team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started. |
From message posted on Discord by 1voy
Also, a little update to those docs with next.js 13/14 route handlers would be nice
The text was updated successfully, but these errors were encountered: