diff --git a/docs/deprecations.md b/docs/deprecations.md
index 4bdfc1b19..feebfd3f4 100644
--- a/docs/deprecations.md
+++ b/docs/deprecations.md
@@ -36,6 +36,14 @@ Note:
- In service configuration setting is ineffective for deprecations reported before service configuration is read.
- `SLS_DEPRECATION_DISABLE` env var and `disabledDeprecations` configuration setting remain respected, and no errors will be thrown for mentioned deprecation coodes.
+
+
+## Duplicate plugin definition in configuration
+
+Deprecation code: `DUPLICATE_PLUGIN_DEFINITION`
+
+Starting with "v3.0.0", duplicate plugin definition will result in an error instead of a warning. To ensure seamless upgrade, please remove duplicate plugins from your configuration.
+
## CLI `-v` alias for `--verbose` option
diff --git a/lib/classes/PluginManager.js b/lib/classes/PluginManager.js
index 02588a5cb..38992dcd7 100644
--- a/lib/classes/PluginManager.js
+++ b/lib/classes/PluginManager.js
@@ -133,9 +133,9 @@ class PluginManager {
// don't load plugins twice
if (this.plugins.some((plugin) => plugin instanceof Plugin)) {
- legacy.log(`WARNING: duplicate plugin ${Plugin.name} was not loaded\n`);
- log.warning(
- `Duplicate plugin definition found in your configuration. Plugin "${Plugin.name}" will not be loaded more than once.`
+ this.serverless._logDeprecation(
+ 'DUPLICATE_PLUGIN_DEFINITION',
+ 'Starting with "v3.0.0", duplicate plugin definition will result in an error instead of a warning. To ensure seamless upgrade, please remove duplicate plugins from your configuration.'
);
return null;
}
diff --git a/test/unit/lib/classes/PluginManager.test.js b/test/unit/lib/classes/PluginManager.test.js
index cc89f44ee..a1c4b4d72 100644
--- a/test/unit/lib/classes/PluginManager.test.js
+++ b/test/unit/lib/classes/PluginManager.test.js
@@ -568,14 +568,6 @@ describe('PluginManager', () => {
expect(pluginManager.plugins[0]).to.be.instanceof(SynchronousPluginMock);
});
- it('should not load plugins twice', () => {
- pluginManager.addPlugin(SynchronousPluginMock);
- pluginManager.addPlugin(SynchronousPluginMock);
-
- expect(pluginManager.plugins[0]).to.be.instanceof(SynchronousPluginMock);
- expect(pluginManager.plugins.length).to.equal(1);
- });
-
it('should load two plugins that happen to have the same class name', () => {
function getFirst() {
return class PluginMock {};