Skip to content

Commit 2588f46

Browse files
committed
Enable setting AWS API Gateway integration timeout
1 parent 3ea171c commit 2588f46

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

lib/plugins/aws/package/compile/events/api-gateway/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ class AwsCompileApigEvents {
208208
private: { type: 'boolean' },
209209
request: requestSchema,
210210
response: responseSchema,
211+
timeoutInMillis: { type: 'integer', minimum: 50 },
211212
},
212213
required: ['path', 'method'],
213214
additionalProperties: false,

lib/plugins/aws/package/compile/events/api-gateway/lib/method/integration.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,16 @@ const DEFAULT_COMMON_TEMPLATE = `
5151
module.exports = {
5252
getMethodIntegration(http, { lambdaLogicalId, lambdaAliasName }) {
5353
const type = http.integration || 'AWS_PROXY';
54+
const globalApiTimeout =
55+
this.serverless.service &&
56+
this.serverless.service.provider &&
57+
this.serverless.service.provider.apiGateway &&
58+
this.serverless.service.provider.apiGateway.timeoutInMillis;
59+
5460
const integration = {
5561
IntegrationHttpMethod: 'POST',
5662
Type: type,
63+
TimeoutInMillis: http.timeoutInMillis || globalApiTimeout || undefined,
5764
};
5865

5966
// Valid integrations are:

lib/plugins/aws/provider.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@ class AwsProvider {
870870
},
871871
shouldStartNameWithService: { type: 'boolean' },
872872
stage: { type: 'string' },
873+
timeoutInMillis: { type: 'integer', minimum: 50 },
873874
usagePlan: {
874875
anyOf: [
875876
apiGatewayUsagePlan,

0 commit comments

Comments
 (0)