🐛 BUG: No static build output when using`@astrojs/rss`
What version of astro are you using?
1.0.0-beta.42
Are you using an SSR adapter? If so, which one?
None (but also does not work with SSR adapter)
What package manager are you using?
npm, yarn
What operating system are you using?
Mac
Describe the Bug
When adding pages/rss.xml.ts (or pages/rss.xml.js), yarn build no longer generates static routes.
This can be verified by downloading the linked stackblitz, and running yarn build:
- as is --> no static HTML output ❌,
- and after deleting
pages/rss.xml.js--> static HTML output ✅
The docs on https://docs.astro.build/en/guides/rss/#using-astrojsrss-recommended suggest that using @astrojs/rss should work with and without SSR adapter. I also tried adding the Netlify adapter, with a similar result: Not even the netlify/functions/ folder was created.
The build command output also reflects this: "generating static routes" does not show any outputs when pages/rss.xml.js is present:
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-ebz6gf-jkeapy?file=src/pages/rss.xml.ts
Participation
- [ ] I am willing to submit a pull request for this issue.
@philipp-tailor Here is a fork of the reproduction that fixes your issue - basically the await getPosts() actually should happen inside the get() function when building the RSS feed
That said, this isn't a great developer experience! Keeping this issue open so we can dig in a bit to see if (1) there's a way we can better catch that and avoid breaking HTML rendering and/or (2) can we throw a helpful build error here that points to the problem
Marking this as a p2-nice-to-have - it isn't technically a broken feature, but there's opportunity for a much better developer experience here as we're getting everything buttoned up for 1.0!
Thank you for the blazing-fast response, and sorry for having reported a bug in my code as Astro bug.
What gave me the believe that my code was not the issue is that everything worked in development mode. Assumed consistency between dev and production is tricky, when there's unknown exceptions.