Commit e4aeea7
fix: await async generateRss/checkDataFromAlgolia in getStaticProps (notionnext-org#3992)
`generateRss` and `checkDataFromAlgolia` are both async functions,
but they were called without `await` inside `getStaticProps`. This
creates a race condition where the build process may finish and
proceed to deployment before the RSS files (public/rss/feed.xml,
atom.xml, feed.json) are actually written to disk.
Contrast with `generateRobotsTxt` and `generateSitemapXml` which
are synchronous and complete immediately — they are unaffected.
Symptoms:
- RSS feed returns 404 or corrupted content after deployment
- The issue is non-deterministic (depends on how many posts need
Notion API calls and whether the build finishes first)
- More likely to manifest in CI/CD environments where the build
completes quickly and immediately copies artifacts
Root cause in generateRss:
- For each post, it calls `await getPostBlocks(post.id, 'rss-content')`
to fetch content from the Notion API
- Then renders each post via `ReactDOMServer.renderToString()`
- Finally writes feed.xml / atom.xml / feed.json to public/rss/
- Without `await`, getStaticProps returns before any of this completes
The fix simply adds `await` to both calls so getStaticProps waits
for file generation to complete before returning.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent e1f0792 commit e4aeea7
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
0 commit comments