diff --git a/docs/deprecations.md b/docs/deprecations.md index d40bd72d5..2e8dc3068 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -38,6 +38,14 @@ Note: - The `serverless.yml` setting is ineffective for deprecations reported before the configuration is read. - `SLS_DEPRECATION_DISABLE` and `disabledDeprecations` remain respected, and no errors will be thrown for mentioned deprecation codes. +
 
+ +## Ineffective property `provider.httpApi.useProviderTags` + +Deprecation code: `AWS_HTTP_API_USE_PROVIDER_TAGS_PROPERTY` + +Starting with "v3.0.0", property `provider.httpApi.useProviderTags` is no longer effective as provider tags are applied to Http Api Gateway by default. You can safely remove this property from your configuration. +
 
## Attempt to enable S3 Transfer Acceleration on provided S3 buckets diff --git a/lib/plugins/aws/package/compile/events/httpApi.js b/lib/plugins/aws/package/compile/events/httpApi.js index d7ce41153..1e7a0cfe0 100644 --- a/lib/plugins/aws/package/compile/events/httpApi.js +++ b/lib/plugins/aws/package/compile/events/httpApi.js @@ -43,6 +43,17 @@ class HttpApiEvents { serverless.httpApiEventsPlugin = this; this.hooks = { + 'initialize': () => { + if ( + this.serverless.service.provider.name === 'aws' && + _.get(this.serverless.service.provider.httpApi, 'useProviderTags') + ) { + this.serverless._logDeprecation( + 'AWS_HTTP_API_USE_PROVIDER_TAGS_PROPERTY', + 'Property "provider.httpApi.useProviderTags" is no longer effective as provider tags are applied to Http Api Gateway by default. You can safely remove this property from your configuration.' + ); + } + }, 'package:compileEvents': () => { this.resolveConfiguration(); if (!this.config.routes.size) return; diff --git a/test/unit/lib/plugins/aws/package/compile/events/httpApi.test.js b/test/unit/lib/plugins/aws/package/compile/events/httpApi.test.js index 7959d038a..2d6b6feea 100644 --- a/test/unit/lib/plugins/aws/package/compile/events/httpApi.test.js +++ b/test/unit/lib/plugins/aws/package/compile/events/httpApi.test.js @@ -1188,4 +1188,23 @@ describe('lib/plugins/aws/package/compile/events/httpApi.test.js', () => { }); }); }); + + it('should trigger a deprecation when `provider.httpApi.useProviderTags` is set', async () => { + await expect( + runServerless({ + fixture: 'httpApi', + configExt: { + provider: { + httpApi: { + useProviderTags: true, + }, + }, + }, + command: 'package', + }) + ).to.eventually.be.rejected.and.have.property( + 'code', + 'REJECTED_DEPRECATION_AWS_HTTP_API_USE_PROVIDER_TAGS_PROPERTY' + ); + }); });