{"record":{"id":"3ba273200270cc84","repo":"remotion-dev/remotion","slug":"failed-to-render-gif-with-source-src-error-3ba273","errorCode":null,"errorMessage":"Failed to render GIF with source ${src}: \"${error.message}\". You must enable CORS for this URL.","messagePattern":"Failed to render GIF with source (.+?): \"(.+?)\"\\. You must enable CORS for this URL\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/gif/src/GifForRendering.tsx","lineNumber":151,"sourceCode":"\t\t\t\t}\n\n\t\t\t\tcontinueRender(newHandle);\n\t\t\t\tcontinueRender(renderHandle);\n\t\t\t};\n\t\t}, [\n\t\t\trenderHandle,\n\t\t\tlogLevel,\n\t\t\tcacheKey,\n\t\t\tresolvedSrc,\n\t\t\tdelayRender,\n\t\t\tcontinueRender,\n\t\t\tdelayRenderTimeoutInMilliseconds,\n\t\t]);\n\n\t\tif (error) {\n\t\t\tInternals.Log.error({logLevel, tag: null}, error.stack);\n\t\t\tif (isCorsError(error)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to render GIF with source ${src}: \"${error.message}\". You must enable CORS for this URL.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to render GIF with source ${src}: \"${error.message}\". Render with --log=verbose to see the full stack.`,\n\t\t\t);\n\t\t}\n\n\t\tif (index === -1) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<Canvas\n\t\t\t\tfit={fit}\n\t\t\t\tindex={index}\n\t\t\t\tframes={state.frames}","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/gif/src/GifForRendering.tsx#L133-L169","documentation":"The render-time counterpart of the Studio CORS error, thrown by GifForRendering during a server-side Remotion render (e.g. `npx remotion render`). When the headless Chrome used for rendering cannot fetch the GIF because of CORS, the render aborts. The component logs the stack via `Internals.Log` at the configured log level and then throws.","triggerScenarios":"Running `remotion render` on a composition containing `<Gif src=\"https://...\">` where the remote host does not grant CORS access to the headless browser origin. Equivalent to error 1040 but in the rendering pipeline.","commonSituations":"Rendering works locally with `staticFile()` but breaks in production/Lambda because `src` was switched to a remote URL whose bucket lacks CORS rules; CORS headers are present for browser origins but not for the render worker's origin; using a signed URL that strips CORS headers.","solutions":["Bundle the GIF with `staticFile()` so the render fetches it from the local bundle server (same origin).","Add CORS rules to the bucket/CDN allowing the render origin (or `*`).","For Remotion Lambda, ensure the S3 bucket serving assets has a CORS configuration that permits GET from the Lambda worker.","Render once with `--log=verbose` to capture the underlying fetch error from the headless browser."],"exampleFix":"// before\n<Gif src=\"https://prod-bucket.s3.amazonaws.com/anim.gif\" />\n\n// after\nimport anim from './anim.gif';\n<Gif src={anim} />","handlingStrategy":"fallback","validationCode":"// Bundle the GIF so renders never depend on remote CORS.\nimport {staticFile} from 'remotion';\nconst gifSrc = staticFile('anim.gif'); // safe for `remotion render`","typeGuard":null,"tryCatchPattern":"// Renders run headless and cannot show a fallback UI, so prevent at build time:\n// fail the render early if any GIF src is remote and unverified.\nconst remoteGifs = collectGifSrcs(composition).filter((u) => u.startsWith('http'));\nif (remoteGifs.length) {\n  throw new Error('Remote GIF srcs must enable CORS: ' + remoteGifs.join(', '));\n}","preventionTips":["Never render against a remote GIF you have not confirmed sends CORS headers to the render worker.","For Remotion Lambda, put assets in an S3 bucket with a CORS policy allowing the worker, or bundle them.","Run a smoke render in CI to catch CORS failures before deploying."],"tags":["gif","cors","render","network","fetch"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}