You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Plugins are "ignored" when provider name is variable #4837
I've noticed in PluginManager, the following snippet:
// ignore plugins that specify a different provider than the current one
if (pluginProvider
&& (pluginProvider !== this.serverless.service.provider.name)) {
return;
}
The issue is the provider variables have not been loaded by this step, so I'm assuming the aws plugins are then ignored?
Serverless Framework Version you're using:
1.26.0 (master branch at time of posting)
This definitely represents a hidden dissonance with the mental model of engineers in using variables within serverless.[json||yml||yaml] and the returned content of serverless.js. One challenge of not doing things in this order is that the proper population of a service can depend upon the provider that the service targets. Not sure whether this one should be marked as a "bug" as "working as expected".
@erikerikson Thanks for replying. I think the misunderstanding comes from how the second example for serverless variables uses the provider as the target, it's not really clear that the provider name has any kind of restriction on it, or any of the provider variables really.
If it's hard baked into the design to not support variables for this provider.name, would it make sense to include a warning in the docs that the provider name cannot be a variable?
That at least seems a reasonable short term mitigation.
I think there's a long term argument for provider being legacy that disappears. Particularly for the rare but important cross provider use cases.
Given the declaration of plugins in serverless.yml, it could seem that the resolution order is somewhat backwards. That said, it's certainly legacy and the way of it for the time being. Switching would also have the potential impact of disallowing plugin's involvement in variable resolution which is desirable for a few rather sticky scenarios involving conflicts.
Activity
erikerikson commentedon Mar 19, 2018
Yes, the filtering of plugins in PluginManager combines with the fact that plugins are loaded in init whereas the service is populated in run and init is called before run.
This definitely represents a hidden dissonance with the mental model of engineers in using variables within
serverless.[json||yml||yaml]and the returned content ofserverless.js. One challenge of not doing things in this order is that the proper population of a service can depend upon the provider that the service targets. Not sure whether this one should be marked as a "bug" as "working as expected".MacMcIrish commentedon Mar 25, 2018
@erikerikson Thanks for replying. I think the misunderstanding comes from how the second example for serverless variables uses the provider as the target, it's not really clear that the provider name has any kind of restriction on it, or any of the provider variables really.
If it's hard baked into the design to not support variables for this
provider.name, would it make sense to include a warning in the docs that the provider name cannot be a variable?erikerikson commentedon Mar 25, 2018
That at least seems a reasonable short term mitigation.
I think there's a long term argument for provider being legacy that disappears. Particularly for the rare but important cross provider use cases.
Given the declaration of plugins in serverless.yml, it could seem that the resolution order is somewhat backwards. That said, it's certainly legacy and the way of it for the time being. Switching would also have the potential impact of disallowing plugin's involvement in variable resolution which is desirable for a few rather sticky scenarios involving conflicts.
medikoo commentedon Mar 3, 2021
Fixed with #8987