Skip to content

🎥 Make videos programmatically with React

also update express.js sample

Jonny Burger4fac27d4bfd4
diff --git a/packages/docs/docs/lambda/webhooks.md b/packages/docs/docs/lambda/webhooks.md
index 21b8dc5bd3..7431c03f5d 100644
--- a/packages/docs/docs/lambda/webhooks.md
+++ b/packages/docs/docs/lambda/webhooks.md
@@ -160,8 +160,26 @@ const router = express();
// body.
const jsonParser = bodyParser.json();
+// Enable testing through the tool below
+const ENABLE_TESTING = true;
+
// Express API endpoint
router.post("/my-remotion-webhook-endpoint", jsonParser, (req, res) => {
+ 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({
signatureHeader: req.header("X-Remotion-Signature"),
body: req.body,
@@ -202,13 +220,13 @@ import {
import { NextApiRequest, NextApiResponse } from "next";
// Enable testing through the tool below
-const enableTesting = true;
+const ENABLE_TESTING = true;
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
- if (enableTesting) {
+ if (ENABLE_TESTING) {
res.setHeader("Access-Control-Allow-Origin", "https://www.remotion.dev");
res.setHeader("Access-Control-Allow-Methods", "OPTIONS,POST");
res.setHeader(