diff --git a/lib/plugins/aws/package/compile/functions/index.js b/lib/plugins/aws/package/compile/functions/index.js index dcebf88cf9b6..7b4ce69f2fee 100644 --- a/lib/plugins/aws/package/compile/functions/index.js +++ b/lib/plugins/aws/package/compile/functions/index.js @@ -31,6 +31,22 @@ class AwsCompileFunctions { .then(this.downloadPackageArtifacts) .then(this.compileFunctions), }; + + if ( + this.serverless.service.provider.name === 'aws' && + Object.values(this.serverless.service.functions).some( + ({ destinations }) => + _.get(destinations, 'maximumRetryAttempts') != null || + _.get(destinations, 'maximumEventAge') + ) + ) { + this.serverless._logDeprecation( + 'AWS_FUNCTION_DESTINATIONS_ASYNC_CONFIG', + '"maximumRetryAttempts" and "dmaximumEventAge" on "functions[].destinations" ' + + 'are deprecated.\n' + + 'Instead configure them directly on "functions[]"' + ); + } } compileRole(newFunction, role) { @@ -597,18 +613,10 @@ class AwsCompileFunctions { if (destinations) { if (destinations.maximumRetryAttempts != null) { - this.serverless._logDeprecation( - 'AWS_FUNCTION_DESTINATIONS_ASYNC_CONFIG', - 'destinations.maximumRetryAttempts is deprecated, use maximumRetryAttempts on function instead' - ); maximumRetryAttemptsOnDestinations = destinations.maximumRetryAttempts; } if (destinations.maximumEventAge) { - this.serverless._logDeprecation( - 'AWS_FUNCTION_DESTINATIONS_ASYNC_CONFIG', - 'destinations.maximumEventAge is deprecated, use maximumEventAge on function instead' - ); maximumEventAgeOnDestinations = destinations.maximumEventAge; }