serverless: Resolver does not reload variable meta

Are you certain it’s a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest version?

  • Yes, I’m using the latest version

Is there an existing issue for this?

  • I have searched existing issues, it hasn’t been reported yet

Issue description

If a plugin changes or adds contents of the configuration (serverless.service) the variables are not resolved as the variablesMeta is just created at start.

The problem can be solved by just running and merging variablesMeta before the last resolveVariables-call.

scripts/serverless.js image

Service configuration (serverless.yml) content

N/A

Command name and used flags

serverless package

Command output

N/A

Environment information

Framework Core: 3.16.0 (local)
Plugin: 6.2.2
SDK: 4.3.2

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 32 (32 by maintainers)

Most upvoted comments

@mklenbw it’s all yours 😃

I’m already done. This works flawlessly. Didn’t expect it to be that easy. Now i’ll need to add some tests as well.

@icholy great to hear that!

Hints on how to achieve that:

  • Expose variablesMeta to Serverless class
  • Introduce serverless.extendConfiguration(configurationPathKeys, value) which should:
    • extend configuration with value at given configurationPathKeys
    • Parse value with lib/configuration/variables/parse and extend variablesMeta with it (taking into account configurationPathKeys) also remove any eventual existing meta atconfigurationPathKeys
    • Ensure that serverless.extendConfiguration throws error if invoked after pluginManager.loadAllPlugins is run.