Skip to content

Commit

Permalink
feat(AWS HTTP API): Switch default payload mode to 2.0 (#8133)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
In AWS HTTP API events (`httpApi`) default `payload` was changed from `1.0` to `2.0`
  • Loading branch information
andreizet authored and medikoo committed Sep 10, 2020
1 parent 4ceaca0 commit 1596738
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions lib/plugins/aws/package/compile/events/httpApi/index.js
Expand Up @@ -482,18 +482,11 @@ Object.defineProperties(
const providerConfig = this.serverless.service.provider;
const userConfig = providerConfig.httpApi || {};

if (!userConfig.payload) {
this.serverless._logDeprecation(
'AWS_HTTP_API_VERSION',
'Default HTTP API Payload version will be switched to 2.0 with next major release. Configure "httpApi.payload" explicitly to hide this message.'
);
}

const properties = {
ApiId: this.getApiIdConfig(),
IntegrationType: 'AWS_PROXY',
IntegrationUri: resolveTargetConfig(routeTargetData),
PayloadFormatVersion: userConfig.payload || '1.0',
PayloadFormatVersion: userConfig.payload || '2.0',
};
if (routeTargetData.timeout) {
properties.TimeoutInMillis = Math.round(routeTargetData.timeout * 1000);
Expand Down
Expand Up @@ -74,7 +74,7 @@ describe('HttpApiEvents', () => {
const resource = cfResources[naming.getHttpApiIntegrationLogicalId('foo')];
expect(resource.Type).to.equal('AWS::ApiGatewayV2::Integration');
expect(resource.Properties.IntegrationType).to.equal('AWS_PROXY');
expect(resource.Properties.PayloadFormatVersion).to.equal('1.0');
expect(resource.Properties.PayloadFormatVersion).to.equal('2.0');
});
it('Should ensure higher timeout than function', () => {
const resource = cfResources[naming.getHttpApiIntegrationLogicalId('foo')];
Expand Down

0 comments on commit 1596738

Please sign in to comment.