Skip to content

Commit

Permalink
fix(AWS Deploy): Throw on attempt of extending not existing resource
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Oct 7, 2021
1 parent 1084251 commit 02be86c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/deprecations.md
Expand Up @@ -382,6 +382,8 @@ Please use `provider.kmsKeyArn` and `functions[].kmsKeyArn`. `service.awsKmsKeyA

Deprecation code: `RESOURCES_EXTENSIONS_REFERENCE_TO_NONEXISTENT_RESOURCE`

_Note: This deprecation was replaced with a thrown error (adding a deprecation here, was a logical error). Please upgrade to latest version of the Framework_

Starting with v3.0.0, extensions to nonexistent resources in `resources.extensions` will throw an error instead of passing silently.

<a name="DISABLE_LOCAL_INSTALLATION_FALLBACK_SETTING"><div>&nbsp;</div></a>
Expand Down
7 changes: 3 additions & 4 deletions lib/plugins/aws/package/lib/mergeCustomProviderResources.js
Expand Up @@ -30,10 +30,9 @@ module.exports = {
for (const [resourceName, resourceDefinition] of Object.entries(extensions)) {
for (const [extensionAttributeName, value] of Object.entries(resourceDefinition)) {
if (!template.Resources[resourceName]) {
template.Resources[resourceName] = {};
this.serverless._logDeprecation(
'RESOURCES_EXTENSIONS_REFERENCE_TO_NONEXISTENT_RESOURCE',
'Starting with next major version, extensions to nonexistent resources will throw an error instead of passing silently.'
throw new ServerlessError(
`Cannot extend "${resourceName}" resource, as it's not found in generated stack`,
'RESOURCE_EXTENSION_NOT_EXISTING'
);
}

Expand Down

0 comments on commit 02be86c

Please sign in to comment.