-
Notifications
You must be signed in to change notification settings - Fork 5.1k
RSS feed error handling #15476
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
RSS feed error handling #15476
Conversation
✅ Deploy Preview for ethereumorg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Pass individual fetch/parse errors from child process and console.warn with parent, continuing processes. Add additional guard to make sure enough blog items were fetch; if less then break build.
handles cases where fetch returns html, but invalid RSS/XML feed
This reverts commit 02da378.
if (allItems.length < RSS_DISPLAY_COUNT) | ||
throw new Error("Insufficient number of RSS items fetched") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't actually breaking the build as-is, since it is contained inside an api function call... 🤔 cc: @pettinarip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, with the addition of generateStaticParams
on the homepage, this throw
should properly break the build if the RSS fetch doesn't return the 6 results desired to display on the homepage.
does not break build as intended, only breaks front end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By design, the fetches under src/lib/api
should throw. The error handling logic should happen at the page level. Currently, the dataLoader
layer is capturing these errors and throwing.
The reason this test is not failing is because the flag USE_MOCK_DATA
is on in preview deploys. To fully test it, you can override the variable in netlify.toml or in netlify UI config.
} | ||
} | ||
return allItems as RSSItem[][] | ||
return allItems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function fetch will never throw, is that the intention? if we want to break the build, we should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want a singular feed to break the build (ie. recent example where one blog changed their feed link)... these cases should just skip over that feed.
BUT, in the event something happens where we don't get ANY feed results, then that should break the build... which was the intent of throwing an error at the end if there aren't enough results.
This reverts commit 360c439.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be good to go cc: @pettinarip @corwintines
@@ -127,6 +128,8 @@ const Page = async ({ params }: { params: Promise<{ locale: Lang }> }) => { | |||
) | |||
} | |||
|
|||
export const generateStaticParams = async () => LOCALES_CODES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forces homepage to builds paths at build, which allows throw Error
to break the build
if (allItems.length < RSS_DISPLAY_COUNT) | ||
throw new Error("Insufficient number of RSS items fetched") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, with the addition of generateStaticParams
on the homepage, this throw
should properly break the build if the RSS fetch doesn't return the 6 results desired to display on the homepage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
fetchRSS
)RSS_DISPLAY_COUNT
) items, else it throws a breaking error. This allows flexibility for small outages or link changes, but will block anything larger that results in missing items in the front end.Related Issue
Recent homepage outage from an external rss feed url being changed