feat: improve profile deployment#358
Merged
LautaroPetaccio merged 9 commits intomainfrom Mar 23, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…-profile-deployment
| * @param disabledCatalysts - Catalyst addresses to exclude from the list | ||
| * @returns Content URLs in the form `{catalystAddress}/content` | ||
| */ | ||
| function getCatalystUrlsForRotation(disabledCatalysts: string[] = []): string[] { |
Contributor
There was a problem hiding this comment.
I think we have this one in a lib already, but I am not finding 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.
Profile deployment had several issues:
Silent failures on HTTP errors:
client.deploy()fromdcl-catalyst-clientreturns the rawResponsewithout throwing on non-2xx status codes. The existing code never checkedresponse.ok, so a 400 or 500 from the catalyst was silently treated as a success.Duplicated deployment logic: Catalyst rotation with retry logic was implemented independently in three places (
AvatarSetupPage/utils.ts,SetupPage/utils.ts, andmodules/profile/index.ts), each with different behavior. TheAvatarSetupPagewas missingisRetryableErrorchecks (retrying on 4xx when it shouldn't), and theSetupPagehad no catalyst rotation at all.Missing disabled catalysts: The
AvatarSetupPageandSetupPagewere not passing thedisabledCatalystsfeature flag list, potentially deploying to catalysts that were intentionally disabled.No useful data in Sentry: When deployment errors were caught, the HTTP status code and response body were not included, making it difficult to diagnose failures.
How
Shared deployment function (
src/modules/profile/deploy.ts)Extracted a single
deployWithCatalystRotationfunction that all deployment paths now use. It:response.okafter eachclient.deploy()callDeploymentError(new class insrc/modules/profile/errors.ts) on non-2xx responses, carryingstatusCode,responseBody, andcatalystUrlFailed to fetch) inDeploymentErroras well, so thecatalystUrlis always preserved for Sentry logging even when there's no HTTP responseisRetryableErrorto skip retries on 4xx client errors and retry on 5xx / network errorsgetCatalystUrlsForRotationand creates its own fetcher, so callers only need to pass the deployment entity and optionallydisabledCatalystsCatalyst URL utilities (
src/modules/profile/utils.ts)Extracted
getCatalystServersandgetCatalystUrlsForRotationfromindex.tsinto a separate file to avoid circular dependencies betweendeploy.tsandindex.ts.Callers updated
AvatarSetupPage/utils.ts: Replaced hand-rolled catalyst loop withdeployWithCatalystRotation. Now passesdisabledCatalysts.SetupPage/utils.ts: Replaced single-catalyst deploy withdeployWithCatalystRotation. Gains catalyst rotation and error detection it previously lacked. Now passesdisabledCatalysts.modules/profile/index.ts:redeployExistingProfileandredeployExistingProfileWithContentServerDatanow use the shared function. Removed the oldredeployWithCatalystRotation,attemptRedeployment, andisRetryableHttpError.AvatarSetupPage.tsxandSetupPage.tsx: AddeduseDisabledCatalysts()hook and pass the value through to deploy functions. AddeddisabledCatalyststouseCallbackdependency arrays.Automatic Sentry context for deployment errors (
src/shared/utils/errorHandler.ts)handleErrornow detectsDeploymentErrorinstances and automatically includesstatusCode,responseBody, andcatalystUrlas Sentry extras. Callers don't need to extract or pass this context themselves.Stabilized
useDisabledCatalystshookThe
useMemodependency was changed from the variant object (which could have a new reference each render) to the primitivepayloadValuestring. A stableEMPTY_LISTconstant is returned when there are no disabled catalysts, preventing unnecessaryuseCallbackrecreations in consuming components.