Skip to content

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

@zzgael

Description

@zzgael

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions