Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: No static build output when using@astrojs/rss #3550

Closed
1 task
philipp-tailor opened this issue Jun 7, 2022 · 4 comments
Closed
1 task

🐛 BUG: No static build output when using@astrojs/rss #3550

philipp-tailor opened this issue Jun 7, 2022 · 4 comments
Labels
- P2: nice to have Not breaking anything but nice to have (priority)

Comments

@philipp-tailor
Copy link

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:

image

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.
@tony-sull
Copy link
Contributor

@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

@tony-sull tony-sull added - P3: minor bug An edge case that only affects very specific usage (priority) s2-medium - P2: nice to have Not breaking anything but nice to have (priority) and removed - P3: minor bug An edge case that only affects very specific usage (priority) labels Jun 7, 2022
@tony-sull
Copy link
Contributor

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!

@philipp-tailor
Copy link
Author

philipp-tailor commented Jun 7, 2022

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.

@matthewp
Copy link
Contributor

matthewp commented Oct 7, 2022

The pattern in this bug no longer works post-1.0 because calling module.default() doesn't give you the content of the .md file now. Instead you pass items to the RSS integration. Closing as I don't think there's anything to be done about this now.

@matthewp matthewp closed this as completed Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority)
Projects
None yet
Development

No branches or pull requests

3 participants