fix(AWS Deploy): Throw on attempt of extending not existing resource

This commit is contained in:
Mariusz Nowak 2021-10-07 12:04:19 +02:00 committed by Mariusz Nowak
parent 10842513f0
commit 02be86ca49
2 changed files with 5 additions and 4 deletions

View File

@ -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>

View File

@ -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'
);
}