UNPKG

@camunda8/sdk

Version:

[![NPM](https://nodei.co/npm/@camunda8/sdk.png)](https://www.npmjs.com/package/@camunda8/sdk)

31 lines (30 loc) 1.75 kB
import { BeforeRetryHook, HandlerFunction, Method } from 'got'; import { CamundaSupportLogger } from './CamundaSupportLogger'; export declare const supportLogger: CamundaSupportLogger; /** * Capturing useful async stack traces is challenging with got. * See here: https://github.com/sindresorhus/got/blob/main/documentation/async-stack-traces.md * This function stores the call point from the application of got requests. * This enables users to see where the error originated from. */ export declare const beforeCallHook: HandlerFunction; /** * This function is used to handle 401 errors in got requests. * It will retry the request only once if the error code is 401. * Otherwise, for 429 and 503 errors, it will retry according to the GotRetryConfig. */ export declare const gotBeforeRetryHook: BeforeRetryHook; /** * Retry configuration for got requests. * This configuration is used to retry requests on certain status codes and methods. * We will retry on 429 (Too Many Requests) and 503 (Service Unavailable) status codes. * 503 and 500 with a specific title or detail string is used for Camunda 8 to indicate server backpressure. * See: https://github.com/camunda/camunda-8-js-sdk/issues/509 and https://github.com/camunda/camunda-8-js-sdk/issues/612 * 401 (Unauthorized) is used for OAuth token refreshes. * We will retry only once on 401 (see the BeforeRetryHook), because the worker polls continuously, and a worker that is misconfigured with an invalid secret will retry indefinitely. * This is not ideal, but it is the current behaviour. We need to ensure that such a worker does not flood the broker, so we cause a backoff. */ export declare const GotRetryConfig: { methods: Method[]; statusCodes: number[]; };