Skip to content

🎥 Make videos programmatically with React

allow redirects

Jonny Burgerb7f24c6678a7
diff --git a/packages/it-tests/src/ssr/render-frames.test.ts b/packages/it-tests/src/ssr/render-frames.test.ts
index f1e5461132..eb15b79715 100644
--- a/packages/it-tests/src/ssr/render-frames.test.ts
+++ b/packages/it-tests/src/ssr/render-frames.test.ts
@@ -12,7 +12,7 @@ import execa from "execa";
test("Legacy SSR way or rendering videos should still work", async () => {
const puppeteerInstance = await openBrowser("chrome");
const compositions = await getCompositions(
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",
+ "https://quizzical-jackson-ad3285.netlify.app/",
{
puppeteerInstance,
}
@@ -38,8 +38,7 @@ test("Legacy SSR way or rendering videos should still work", async () => {
imageFormat: "jpeg",
inputProps: {},
onFrameUpdate: () => undefined,
- webpackBundle:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",
+ webpackBundle: "https://quizzical-jackson-ad3285.netlify.app/",
parallelism: null,
frameRange: [0, 10],
outputDir: framesDir,
diff --git a/packages/it-tests/src/ssr/render-media.test.ts b/packages/it-tests/src/ssr/render-media.test.ts
index d1de3adf99..151189b7f0 100644
--- a/packages/it-tests/src/ssr/render-media.test.ts
+++ b/packages/it-tests/src/ssr/render-media.test.ts
@@ -6,7 +6,7 @@ import { existsSync } from "fs";
test("Render video with browser instance open", async () => {
const puppeteerInstance = await openBrowser("chrome");
const compositions = await getCompositions(
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",
+ "https://quizzical-jackson-ad3285.netlify.app/",
{
puppeteerInstance,
}
@@ -25,8 +25,7 @@ test("Render video with browser instance open", async () => {
await renderMedia({
outputLocation: outPath,
codec: "h264",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",
+ serveUrl: "https://quizzical-jackson-ad3285.netlify.app/",
composition: reactSvg,
frameRange: [0, 2],
puppeteerInstance,
@@ -37,7 +36,7 @@ test("Render video with browser instance open", async () => {
test("Render video with browser instance not open", async () => {
const compositions = await getCompositions(
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html"
+ "https://quizzical-jackson-ad3285.netlify.app/"
);
const reactSvg = compositions.find((c) => c.id === "react-svg");
@@ -53,8 +52,7 @@ test("Render video with browser instance not open", async () => {
await renderMedia({
outputLocation: outPath,
codec: "h264",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",
+ serveUrl: "https://quizzical-jackson-ad3285.netlify.app/",
composition: reactSvg,
frameRange: [0, 2],
});
@@ -71,8 +69,7 @@ test("should fail on invalid CRF", async () => {
return renderMedia({
outputLocation: outPath,
codec: "h264",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",
+ serveUrl: "https://quizzical-jackson-ad3285.netlify.app/",
// @ts-expect-error
crf: "wrong",
config: {
diff --git a/packages/it-tests/src/ssr/render-still.test.ts b/packages/it-tests/src/ssr/render-still.test.ts
index f3f98acd88..5f19c84783 100644
--- a/packages/it-tests/src/ssr/render-still.test.ts
+++ b/packages/it-tests/src/ssr/render-still.test.ts
@@ -1,12 +1,21 @@
import os from "os";
-import { getCompositions, openBrowser, renderStill } from "@remotion/renderer";
+import {
+ getCompositions,
+ openBrowser,
+ RenderInternals,
+ renderStill,
+} from "@remotion/renderer";
import path from "path";
import { existsSync } from "fs";
+afterEach(async () => {
+ await RenderInternals.killAllBrowsers();
+});
+
test("Render video with browser instance open", async () => {
const puppeteerInstance = await openBrowser("chrome");
const compositions = await getCompositions(
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",
+ "https://quizzical-jackson-ad3285.netlify.app/",
{
puppeteerInstance,
}
@@ -24,8 +33,7 @@ test("Render video with browser instance open", async () => {
await renderStill({
output: outPath,
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",
+ serveUrl: "https://quizzical-jackson-ad3285.netlify.app/",
composition: reactSvg,
puppeteerInstance,
});
@@ -34,7 +42,7 @@ test("Render video with browser instance open", async () => {
test("Render still with browser instance not open and legacy webpack config", async () => {
const compositions = await getCompositions(
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html"
+ "https://quizzical-jackson-ad3285.netlify.app/"
);
const reactSvg = compositions.find((c) => c.id === "react-svg");
@@ -49,8 +57,7 @@ test("Render still with browser instance not open and legacy webpack config", as
await renderStill({
output: outPath,
- webpackBundle:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/testbed/index.html",
+ webpackBundle: "https://quizzical-jackson-ad3285.netlify.app/",
composition: reactSvg,
});
expect(existsSync(outPath)).toBe(true);
diff --git a/packages/renderer/src/set-props-and-env.ts b/packages/renderer/src/set-props-and-env.ts
index 5be355bb4d..f7dd067650 100644
--- a/packages/renderer/src/set-props-and-env.ts
+++ b/packages/renderer/src/set-props-and-env.ts
@@ -27,9 +27,16 @@ export const setPropsAndEnv = async ({
const urlToVisit = normalizeServeUrl(serveUrl);
const pageRes = await page.goto(urlToVisit);
- if (pageRes.status() !== 200) {
+ const status = pageRes.status();
+ if (
+ status !== 200 &&
+ status !== 301 &&
+ status !== 302 &&
+ status !== 303 &&
+ status !== 304
+ ) {
throw new Error(
- `Error while getting compositions: Tried to go to ${urlToVisit} but the status code was ${pageRes.status()} instead of 200. Does the site you specified exist?`
+ `Error while getting compositions: Tried to go to ${urlToVisit} but the status code was ${status} instead of 200. Does the site you specified exist?`
);
}