Skip to content

TLA regression in v6 #15575

@jcayzac

Description

@jcayzac

Astro Info

Astro                    v6.0.0-beta.13
Node                     v22.22.0
System                   macOS (arm64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When using an image() in a content collection schema in the attached minimal repro, if an entry uses an SVG, astro build exits early without generating any page and without returning an error code.

The repro repo is trimmed down to a minimum. The only dependencies are astro and @astrojs/check. Note that I cannot provide a link to Stackblitz, since Astro v6 requires Node 22 and Stackblitz only provides Node 20.

Here's the README of the repro, with all the details:


In the latest v5, astro build generates the expected HTML files for all articles, but in v6 beta it does not. It just exits with no error and no generated files. Trying all the NODE_OPTIONS I could think of did not help.

Using image() in the content schema, and any SVG image in the entry, seems to trigger it. See the comment in content/articles/article-2.yaml.

How to reproduce

The repro uses node 22.22.0 and pnpm 10.30.0, although I don't think it matters much. I had the exact same issue with node 25 and pnpm 10.29.

I trimmed everything down to the bare minimum, so the entries' content isn't even used and the articles are just a YAML collection (as to not depend on MDX or anything else).

# Make sure to clear everything before any new build
rm -rf node_modules/.astro .astro dist

# Build. The NODE_OPTIONS don't really matter, since there's nothing
# reported anyway.
NODE_OPTIONS="\
  --unhandled-rejections strict \
  --trace-warnings \
  --report-on-fatalerror \
  --report-uncaught-exception \
  --trace-uncaught \
" astro build

The weird "fix"

See the comment in content/articles/article-2.yaml:

# it works if commented out and the next one is used instead :(
hero: './boy-reading.svg'
# hero: './hero1.webp'

Changing from an SVG (relative or not) to a WEBP (relative or not) makes the build work as expected, i.e. generate the HTML files for the two articles.

--- 1/build.svg.log
+++ 2/build.webp.log
@@ -12,3 +12,10 @@
 [build] Rearranging server assets...

  generating static routes
+  ├─ /article-2/index.html (+##ms)
+  ├─ /article-1/index.html (+##ms)
+✓ Completed in ##ms.
+
+[build] ✓ Completed in ##ms.
+[build] 2 page(s) built in ##ms
+[build] Complete!

Observations

  1. The SVG image gets copied into dist/_astro/, like the WEBP.
  2. Whenever the SVG image is used, the getStaticPaths() function (in src/pages/[id]/index.astro) is never invoked (if I log to the console first thing inside it, that log is never emitted).
  3. In src/pages/[id]/index.astro, if I don't use a top-level await and instead move the call to getCollection() inside of getStaticPaths(), the build works as expected.

Tip

This suggest an Astro v6 regression related to top-level awaits.

What's the expected result?

The build used to work fine up to the latest v5.

Link to Minimal Reproducible Example

https://github.com/jcayzac/astro-repro-v6-svg

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions