Skip to content

Commit

Permalink
feat(lambda): increase timeout to 5 minutes #3954
Browse files Browse the repository at this point in the history
  • Loading branch information
sannicm authored Oct 25, 2023
1 parent 1d8e3f0 commit 80817a2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/shared/clients/lambdaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import { getLogger } from '../logger'
import { ClassToInterfaceType } from '../utilities/tsUtils'

export type LambdaClient = ClassToInterfaceType<DefaultLambdaClient>

export class DefaultLambdaClient {
public constructor(public readonly regionCode: string) {}
private readonly defaultTimeoutInMs: number

public constructor(public readonly regionCode: string) {
this.defaultTimeoutInMs = 5 * 60 * 1000 // 5 minutes (SDK default is 2 minutes)
}

public async deleteFunction(name: string): Promise<void> {
const sdkClient = await this.createSdkClient()
Expand Down Expand Up @@ -116,6 +121,10 @@ export class DefaultLambdaClient {
}

private async createSdkClient(): Promise<Lambda> {
return await globals.sdkClientBuilder.createAwsService(Lambda, undefined, this.regionCode)
return await globals.sdkClientBuilder.createAwsService(
Lambda,
{ httpOptions: { timeout: this.defaultTimeoutInMs } },
this.regionCode
)
}
}

0 comments on commit 80817a2

Please sign in to comment.