Harden build-time API fetches against transient failures#204
Open
gcutrini wants to merge 5 commits into
Open
Conversation
Build-time SSR fetchers were catching errors with console.log and returning undefined, causing downstream code to crash with confusing TypeError on .length. Replaces the swallow pattern with a SSR_handleError helper that throws an Error including HTTP status, URL, and the original axios error as cause.
Prevents a hung upstream connection from stalling the Netlify build.
Previously a token-fetch failure was logged and the function returned undefined, causing every downstream SSR_get* call to fail with a misleading 401 instead of the actual auth issue.
…equests Adds getWithRetry helper with exponential backoff that retries on 502/503/504 or network errors. Wired into all build-time API fetches so a single transient hiccup no longer fails the entire build.
Pagination remainder fetches were fanned out unbounded via Promise.all. For high-volume summits this caused 25+ concurrent requests per endpoint, raising the probability of upstream timeouts. Now processed in chunks of 5.
✅ Deploy Preview for qa-fnvirtual ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ref: https://app.clickup.com/t/86ba4uy6z
Summary
.catch(e => console.log(...))pattern in every build-time SSR fetcher with aSSR_handleErrorhelper that throws an Error including HTTP status, URL, and axios cause.getAccessTokenthrow on failure instead of returning undefined, which previously caused every downstream request to fail with a misleading 401.getWithRetryhelper (src/utils/build-json/getWithRetry.js) with exponential backoff that retries on 502/503/504 and network errors. Wired into all build-time API fetches.SSR_GetRemainingPagesat 5 instead of unboundedPromise.all, so high-volume summits no longer fire 25+ concurrent requests per endpoint.Background
A yoco Netlify build (event-site 2.1.53, summit 69) failed when one of the parallel speaker page fetches returned a transient HTTP 502. The error was swallowed, the next line accessed
.lengthonundefined, and the build crashed with a confusingTypeErrorinstead of a useful "HTTP 502 on speakers endpoint" message. Other client themes succeeded at the same time because they had 0-1 remaining pages versus yoco's 26+.