diff --git a/.changeset/tender-chicken-deliver.md b/.changeset/tender-chicken-deliver.md new file mode 100644 index 000000000..bd2056e31 --- /dev/null +++ b/.changeset/tender-chicken-deliver.md @@ -0,0 +1,5 @@ +--- +"@opennextjs/aws": patch +--- + +When copying over assets, check to see if favicon.ico is a file. In some cases favicon.ico is a folder that can contain a route handler. diff --git a/packages/open-next/src/build/createAssets.ts b/packages/open-next/src/build/createAssets.ts index 322d642af..2c9206c96 100644 --- a/packages/open-next/src/build/createAssets.ts +++ b/packages/open-next/src/build/createAssets.ts @@ -44,7 +44,9 @@ export function createStaticAssets(options: buildHelper.BuildOptions) { const faviconPath = path.join(appPath, appSrcPath, "favicon.ico"); - if (fs.existsSync(faviconPath)) { + // We need to check if the favicon is either a file or directory. + // If it's a directory, we assume it's a route handler and ignore it. + if (fs.existsSync(faviconPath) && fs.lstatSync(faviconPath).isFile()) { fs.copyFileSync(faviconPath, path.join(outputPath, "favicon.ico")); } }