diff --git a/.changeset/slow-cherries-bake.md b/.changeset/slow-cherries-bake.md new file mode 100644 index 000000000000..ed2837ca09cf --- /dev/null +++ b/.changeset/slow-cherries-bake.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Error reporting fails on undefined error index diff --git a/packages/astro/src/core/errors/dev/utils.ts b/packages/astro/src/core/errors/dev/utils.ts index a36ffc8d833e..6bcdaba6eb57 100644 --- a/packages/astro/src/core/errors/dev/utils.ts +++ b/packages/astro/src/core/errors/dev/utils.ts @@ -20,7 +20,7 @@ export const incompatPackageExp = new RegExp(`(${Object.keys(incompatiblePackage * Useful for consistent reporting regardless of where the error surfaced from. */ export function collectErrorMetadata(e: any, rootFolder?: URL | undefined): ErrorWithMetadata { - const err = AggregateError.is(e) ? (e.errors as SSRError[]) : [e as SSRError]; + const err = AggregateError.is(e) || Array.isArray((e as any).errors) ? (e.errors as SSRError[]) : [e as SSRError]; err.forEach((error) => { if (error.stack) {