Skip to content

Commit

Permalink
feat(AWS Lambda): Ensure to log deprecation at initialization stage
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Nov 3, 2020
1 parent 8023118 commit ed328f1
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions lib/plugins/aws/package/compile/functions/index.js
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit ed328f1

Please sign in to comment.