Skip to content

Commit 16b0cd6

Browse files
authored
feat(AWS HTTP API): Use the default API Gateway timeout of 30s (#11223)
1 parent 2ac55b0 commit 16b0cd6

File tree

3 files changed

+3
-21
lines changed

3 files changed

+3
-21
lines changed

docs/providers/aws/events/http-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ functions:
7373
7474
### Endpoints timeout
7575
76-
Framework ensures that function timeout setting (which defaults to 6 seconds) is respected in HTTP API endpoint configuration. Still note that maximum possible timeout for an endpoint is 29 seconds. Ensure to keep function timeout below that. Otherwise you may observe successful lambda invocations reported with `503` status code.
76+
The default and maximal API Gateway timeout is used: 30s. Ensure to keep function timeout below 29s. Otherwise, you may observe successful lambda invocations reported with `503` status code.
7777

7878
### CORS Setup
7979

lib/plugins/aws/package/compile/events/http-api.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,6 @@ Object.defineProperties(
611611
'for a successful lambda invocation.'
612612
);
613613
}
614-
// Ensure endpoint has slightly larger timeout than a function,
615-
// It's a margin needed for some side processing time on AWS side.
616-
// Otherwise there's a risk of observing 503 status for successfully resolved invocation
617-
// (which just fit function timeout setting)
618-
routeTargetData.timeout = Math.min(functionTimeout + 0.5, 30);
619614
}
620615
}),
621616
compileIntegration: d(function (routeTargetData) {
@@ -630,9 +625,6 @@ Object.defineProperties(
630625
IntegrationUri: resolveTargetConfig(routeTargetData),
631626
PayloadFormatVersion: funcHttpApi.payload || providerHttpApi.payload || '2.0',
632627
};
633-
if (routeTargetData.timeout) {
634-
properties.TimeoutInMillis = Math.round(routeTargetData.timeout * 1000);
635-
}
636628
this.cfTemplate.Resources[
637629
this.provider.naming.getHttpApiIntegrationLogicalId(routeTargetData.functionName)
638630
] = {

test/unit/lib/plugins/aws/package/compile/events/http-api.test.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,9 @@ describe('lib/plugins/aws/package/compile/events/httpApi.test.js', () => {
129129
expect(resource.Properties.RouteKey).to.equal(routeKey);
130130
});
131131

132-
it('should ensure higher timeout than function default value', () => {
132+
it('should let the default api gateway timeout by not setting the TimeoutInMillis property', () => {
133133
const resource = cfResources[naming.getHttpApiIntegrationLogicalId('foo')];
134-
expect(resource.Properties.TimeoutInMillis).to.equal(6500);
135-
});
136-
137-
it('should provide 0.5s time margin to custom function integration timeout', () => {
138-
const resource = cfResources[naming.getHttpApiIntegrationLogicalId('customTimeout')];
139-
expect(resource.Properties.TimeoutInMillis).to.equal(29500);
140-
});
141-
142-
it('should limit function maximum integration timeout to 30s', () => {
143-
const resource = cfResources[naming.getHttpApiIntegrationLogicalId('maxTimeout')];
144-
expect(resource.Properties.TimeoutInMillis).to.equal(30000);
134+
expect(resource.Properties.TimeoutInMillis).to.be.undefined;
145135
});
146136

147137
it('should configure lambda permissions', () => {

0 commit comments

Comments
 (0)