diff --git a/examples/aws-nextjs/components/form.tsx b/examples/aws-nextjs/components/form.tsx index 8a71800f4..adaa22afd 100644 --- a/examples/aws-nextjs/components/form.tsx +++ b/examples/aws-nextjs/components/form.tsx @@ -9,7 +9,7 @@ export default function Form({ url }: { url: string }) { onSubmit={async (e) => { e.preventDefault(); - const file = (e.target as HTMLFormElement).file.files?.[0]!; + const file = (e.target as HTMLFormElement).file.files?.[0] ?? null; const image = await fetch(url, { body: file, diff --git a/www/src/content/docs/docs/start/aws/nextjs.mdx b/www/src/content/docs/docs/start/aws/nextjs.mdx index 1ad917ec2..6d1ca360e 100644 --- a/www/src/content/docs/docs/start/aws/nextjs.mdx +++ b/www/src/content/docs/docs/start/aws/nextjs.mdx @@ -110,7 +110,7 @@ export default function Form({ url }: { url: string }) { onSubmit={async (e) => { e.preventDefault(); - const file = (e.target as HTMLFormElement).file.files?.[0]!; + const file = (e.target as HTMLFormElement).file.files?.[0] ?? null; const image = await fetch(url, { body: file,