fix(build): don't block deploys when Algolia sync fails - #145
Merged
Merged
Conversation
The Algolia sync step ran inside 'npm run build' and any Algolia API error (the app is currently blocked: 'This operation cannot be processed, the application is blocked') failed the whole Cloudflare build, so merged docs never got published. Catch sync errors and continue deploying; the search index just stays stale until the account issue is resolved. Also skip the sync on Cloudflare preview builds (CF_PAGES_BRANCH != main). Each preview re-indexed all ~2.5k pages and burned the Algolia operation quota, which is the likely cause of the block. Verified locally: no-key skip, preview-branch skip, and an Algolia ApiError (invalid key) all exit 0 with a log line; successful sync behavior is unchanged.
|
@majinghe is attempting to deploy a commit to the overtrue's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Problem
The Cloudflare production build for #144 failed after generating all 2515 pages — at the final
sync-algolia.mjsstep:Because the sync runs inside
npm run build, the whole build was marked failed and the deploy was never published — merged docs (including the capo guide) are not live yet.Fix
scripts/sync-algolia.mjs:CF_PAGES_BRANCHis set and isn'tmain, skip the sync. Each PR preview currently re-indexes all ~2.5k pages, burning Algolia operations — the likely cause of the application block in the first place.Verification
node --check scripts/sync-algolia.mjs— OKALGOLIA_ADMIN_API_KEY→ skipped, exit 0 (unchanged behavior)CF_PAGES_BRANCH=docs/capo-integration+ key set → skipped, exit 0 (new)ApiErrorfailure mode) → warns and exits 0; deploy continues (new)Follow-ups (outside this repo)
L2SE8QG99N(contact Algolia support / check billing & quota). Until then, on-site search may also be affected even after this deploy publishes.