diff --git a/docs/deprecations.md b/docs/deprecations.md index 9c3d8714a..4bdfc1b19 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -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.
 
diff --git a/lib/plugins/aws/package/lib/mergeCustomProviderResources.js b/lib/plugins/aws/package/lib/mergeCustomProviderResources.js index 85a99005a..314d5aa41 100644 --- a/lib/plugins/aws/package/lib/mergeCustomProviderResources.js +++ b/lib/plugins/aws/package/lib/mergeCustomProviderResources.js @@ -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' ); }