You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the newer version of Nextjs that we are using, components are server components by default, so fetching is done at build time by default. We are fetching our list of resources from a pod (onboarding.solidcommunity.net), and this is causing a problem when solidcommunity.net goes down, because the failed fetch breaks the build, meaning that we can't deploy any new code changes while the pod is unreachable. It also blocks development, since the fetch is called every time the page refreshes when using npm run dev.
We could put the fetch in a try catch block, and return a hardcoded list of resources when the fetch fails, but that would mean that when we make updates to the code, if the fetch fails, we will revert back to a (possibly older and out of sync) list of resources.
We need to do something like this: cache (or otherwise store?) the most recent successful pod response, and if the fetch fails, use the most recent one instead. I'm not sure if this needs to be done using Github's actions workflow (in the yml file?)--in which case we'd need a separate solution for preventing this from blocking development (a try catch block delivering static results when in dev env would probably be fine)--or in our frontend code. Not sure if Nextjs provides a solution--the new server components use fetch's default cache behavior, which is similar to the deprecated getStaticProps, but that doesn't (as far as I can tell) resolve the problem when the fetch fails at build time.
The text was updated successfully, but these errors were encountered:
In the newer version of Nextjs that we are using, components are server components by default, so fetching is done at build time by default. We are fetching our list of resources from a pod (onboarding.solidcommunity.net), and this is causing a problem when solidcommunity.net goes down, because the failed fetch breaks the build, meaning that we can't deploy any new code changes while the pod is unreachable. It also blocks development, since the fetch is called every time the page refreshes when using
npm run dev
.We could put the fetch in a try catch block, and return a hardcoded list of resources when the fetch fails, but that would mean that when we make updates to the code, if the fetch fails, we will revert back to a (possibly older and out of sync) list of resources.
We need to do something like this: cache (or otherwise store?) the most recent successful pod response, and if the fetch fails, use the most recent one instead. I'm not sure if this needs to be done using Github's actions workflow (in the yml file?)--in which case we'd need a separate solution for preventing this from blocking development (a try catch block delivering static results when in dev env would probably be fine)--or in our frontend code. Not sure if Nextjs provides a solution--the new server components use fetch's default cache behavior, which is similar to the deprecated getStaticProps, but that doesn't (as far as I can tell) resolve the problem when the fetch fails at build time.
The text was updated successfully, but these errors were encountered: