🎥 Make videos programmatically with React
fix timeout logic
Jonny Burgerc8b4be5eb7ac
diff --git a/packages/core/src/config/timeout.ts b/packages/core/src/config/timeout.tsindex 245c973fe2..d34f852cc9 100644--- a/packages/core/src/config/timeout.ts+++ b/packages/core/src/config/timeout.ts@@ -4,7 +4,10 @@ let currentTimeout: number = DEFAULT_PUPPETEER_TIMEOUT;export const setPuppeteerTimeout = (newPuppeteerTimeout: number) => {if (typeof newPuppeteerTimeout !== 'number') {- throw new Error('--concurrency flag must be a number.');+ throw new Error(+ '--timeout flag / setTimeoutInMilliseconds() must be a number, but got ' ++ JSON.stringify(newPuppeteerTimeout)+ );}currentTimeout = newPuppeteerTimeout;diff --git a/packages/docs/docs/timeout.md b/packages/docs/docs/timeout.mdindex 459da10c09..aaf4c160bc 100644--- a/packages/docs/docs/timeout.md+++ b/packages/docs/docs/timeout.md@@ -50,6 +50,19 @@ Especially 1.x releases could timeout when importing large assets[Open an issue](https://github.com/remotion-dev/remotion/issues/new) and try to describe your issue in a way that is reproducible for us. We will try to help you out.+## Increase timeout++Sometimes, you cannot avoid a render taking longer than 30 seconds. For example:++- Expensive WebGL scenes+- Expensive preprocessing of data++You can increase the default timeout from v2.6.2 on:++- Using the [`--timeout`](/docs/cli#--timeout) CLI flag+- Using the `timeoutInMilliseconds` option in [`renderStill()`](/docs/render-still#timeoutinmilliseconds), [`renderFrames()`](/docs/render-frames#timeoutinmilliseconds) and [`getCompositions()`](/docs/get-compositions#timeoutinmilliseconds)+- Using the [`Config.Puppeteer.setTimeoutInMilliseconds()`](/docs/config#settimeoutinmilliseconds) option in the config file+## See also- [delayRender()](/docs/delay-render)diff --git a/packages/renderer/src/set-props-and-env.ts b/packages/renderer/src/set-props-and-env.tsindex 45ac19bc43..ce3985f639 100644--- a/packages/renderer/src/set-props-and-env.ts+++ b/packages/renderer/src/set-props-and-env.ts@@ -23,6 +23,7 @@ export const setPropsAndEnv = async ({page.setDefaultTimeout(actualTimeout);page.setDefaultNavigationTimeout(actualTimeout);+ await page.goto(`http://localhost:${port}/index.html`);await page.evaluate((key, value) => {window.localStorage.setItem(key, value);@@ -30,36 +31,31 @@ export const setPropsAndEnv = async ({Internals.PUPPETEER_TIMEOUT_KEY,actualTimeout);+ if (inputProps) {+ await page.evaluate(+ (key, input) => {+ window.localStorage.setItem(key, input);+ },+ Internals.INPUT_PROPS_KEY,+ JSON.stringify(inputProps)+ );+ }- if (inputProps || envVariables) {- await page.goto(`http://localhost:${port}/index.html`);-- if (inputProps) {- await page.evaluate(- (key, input) => {- window.localStorage.setItem(key, input);- },- Internals.INPUT_PROPS_KEY,- JSON.stringify(inputProps)- );- }-- if (envVariables) {- await page.evaluate(- (key, input) => {- window.localStorage.setItem(key, input);- },- Internals.ENV_VARIABLES_LOCAL_STORAGE_KEY,- JSON.stringify(envVariables)- );- }-+ if (envVariables) {await page.evaluate(- (key, value) => {- window.localStorage.setItem(key, value);+ (key, input) => {+ window.localStorage.setItem(key, input);},- Internals.INITIAL_FRAME_LOCAL_STORAGE_KEY,- initialFrame+ Internals.ENV_VARIABLES_LOCAL_STORAGE_KEY,+ JSON.stringify(envVariables));}++ await page.evaluate(+ (key, value) => {+ window.localStorage.setItem(key, value);+ },+ Internals.INITIAL_FRAME_LOCAL_STORAGE_KEY,+ initialFrame+ );};