Skip to content

🎥 Make videos programmatically with React

Improve error handling when Lambda is not configured

ASchwad28b5f892bb62
diff --git a/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/RenderControls/Error.tsx b/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/RenderControls/Error.tsx
index 28020e53c2..7b0b79a405 100644
--- a/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/RenderControls/Error.tsx
+++ b/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/RenderControls/Error.tsx
@@ -1,25 +1,47 @@
import React from "react";
+const isLambdaNotConfiguredError = (message: string): boolean => {
+ return (
+ message.includes("Set up Remotion Lambda") ||
+ message.includes("Function not found:")
+ );
+};
+
export const ErrorComp: React.FC<{
message: string;
}> = ({ message }) => {
+ const isLambdaError = isLambdaNotConfiguredError(message);
+
+ if (isLambdaError) {
+ return (
+ <div className="py-2">
+ <div className="text-destructive text-sm font-semibold font-sans">
+ Lambda not configured
+ </div>
+ <div className="text-destructive-foreground text-sm font-sans mt-1">
+ To render videos, set up Remotion Lambda and add your AWS credentials
+ to the <code className="font-mono text-xs">.env</code> file.{" "}
+ <a
+ href="https://www.remotion.dev/docs/lambda/setup"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline"
+ >
+ Setup guide
+ </a>
+ </div>
+ </div>
+ );
+ }
+
return (
- <div className="text-geist-error font-geist py-geist-half">
- <svg
- fill="none"
- shapeRendering="geometricPrecision"
- stroke="currentColor"
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth="2"
- viewBox="0 0 24 24"
- className="h-5 align-text-bottom mr-1.5 inline"
- >
- <circle cx="12" cy="12" r="10" fill="var(--geist-fill)"></circle>
- <path d="M12 8v4" stroke="currentColor"></path>
- <path d="M12 16h.01" stroke="currentColor"></path>
- </svg>
- <strong>Error:</strong> {message}
+ <div className="py-2">
+ <div className="text-destructive text-sm font-semibold font-sans">
+ Error
+ </div>
+ <div className="text-destructive-foreground text-sm font-mono mt-1 whitespace-pre-wrap break-words">
+ {message}
+ </div>
</div>
);
};
diff --git a/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/RenderControls/index.tsx b/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/RenderControls/index.tsx
index a9e3ac5037..1814ffc867 100644
--- a/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/RenderControls/index.tsx
+++ b/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/RenderControls/index.tsx
@@ -36,12 +36,11 @@ export const RenderControls: React.FC<{
state.status === "error"
) {
return (
- <div className="flex flex-col gap-2">
+ <div>
<Button
disabled={state.status === "invoking" || !code}
loading={state.status === "invoking"}
onClick={renderMedia}
- className="w-full"
>
<Download className="w-4 h-4 mr-2" />
{state.status === "invoking"