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

Retries after timeout errors immediately run into timeout after 0 ms #880

Closed
holzerch opened this issue Dec 13, 2024 · 1 comment
Closed

Comments

@holzerch
Copy link

Retries after timeout errors immediately run into timeout after 0 ms

It looks like the SDK is reusing the AbortController from the initial request. But this is already timed out and will no longer work. Possible solution: Create a new AbortController for every request/retry

Here is a screenshot from our logs when the issue happens: The logging is done by wrapper around the fetch function. NETWORK_ERROR means there was no HTTP response status code
image

here the init of the client

const ctpClient = new ClientBuilder()
            .withProjectKey(config.projectKey)
            .withClientCredentialsFlow({
                host: `https://auth.${config.region}.gcp.commercetools.com`,
                httpClient: fetchWithDefaults,
                projectKey: config.projectKey,
                credentials: {
                    clientId: config.clientId,
                    clientSecret: config.clientSecret,
                },
            })
            .withHttpMiddleware({
                host: `https://api.${config.region}.gcp.commercetools.com`,
                httpClient: fetchWithDefaults,
                enableRetry: true,
                timeout: 5000,
                retryConfig: {
                    retryOnAbort: true,
                    maxRetries: 4,
                    retryDelay: 400,
                    retryCodes: [504, 503, 502, 500],
                },
            })
            .withConcurrentModificationMiddleware()
            .build()
@holzerch
Copy link
Author

Fixed with the latest version. Thank you

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