Skip to content
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

No retry on HTTP Error 520 ( Unknown error ) #432

Open
zzgael opened this issue Dec 30, 2024 · 1 comment
Open

No retry on HTTP Error 520 ( Unknown error ) #432

zzgael opened this issue Dec 30, 2024 · 1 comment

Comments

@zzgael
Copy link

zzgael commented Dec 30, 2024

This is the first time that I get to see it but the API just thrown a html-shaped 520 error.
Return webpage title was : api.hubapi.com | 520: Web server is returning an unknown error

This error is not handled by the /hubspot/api-client/lib/RetryMiddlewareFactory.php

    public static function createInternalErrorsMiddleware(
        ?callable $delayFunction = null,
        int $maxRetries = 5
    ) {
        return static::createMiddlewareByHttpCodeRange(500, 504, $delayFunction, $maxRetries);
    }

Solution : change the handled HTTP Error codes to the following ranges : 500-503 and 520-599.
Two proposed changes :

  • 504 is removed from the list to allow for a retry in case of server failure.
  • range 520-599 is added in order to allow for new codes like the 525 Cloudflare one.

Range 505-511 would still be considered as an exception without retry.

@zzgael
Copy link
Author

zzgael commented Dec 30, 2024

#433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant