-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Referenced variables in the Serverless.yml incorrectly rendered as [Object object]
#3003
Comments
Here's my config demonstrating the problem: service: test-service
plugins:
- debug-plugin
config: ${file(config.json)}
configEnv: ${file(config.json):env}
configEnvProp: ${file(config.json):env.development}
provider:
name: aws
stage: development
runtime: nodejs4.3
environment:
NODE_ENV: ${self:provider.stage}
fileConfig: ${file(config.json)}
fileConfigEnv: ${file(config.json):env}
fileConfigEnvProp: ${file(config.json):env.development}
selfConfig: ${self:config}
selfConfigEnv: ${self:configEnv}
selfConfigEnvProp: ${self:configEnvProp}
selfConfigDotEnv: ${self:config.env}
selfConfigDotEnvDotProp: ${self:config.env.development}
functions:
hello:
handler: handler.hello I wrote a plugin to dump
Not quite sure what could cause that output! Plugin source for reference: class Debug {
constructor(serverless, options) {
this.serverless = serverless;
this.options = options;
this.commands = {
debug: {
usage: 'Debugging',
commands: {
config: {
usage: 'Show configuration value',
lifecycleEvents: [
'print'
]
}
}
}
};
this.hooks = {
'debug:config:print': () => this.printConfig(),
};
}
printConfig() {
const config = Object.assign({}, this.serverless.service);
delete config.serverless;
const output = require('util').inspect(config, { colors: true, depth: null });
console.log(output.substring(0, 100000)); // Paranoia: can't kill node sync output on Ubuntu on Windows?
}
}
module.exports = Debug; |
@simonbuchan I'm guessing the issue is that you're getting undefined for your variable references? I think the reason is that you have custom:
config:
configEnv:
... And dont forget to update your references |
Closing since the variables need to be nested in |
This is a (Bug Report / Feature Proposal)
Description
When using
site_config: ${file(./config/${opt:stage}/site.yml)}
syntax in theserverless.yml
file the variables referenced later in the serverless file (ex:site_secret_key: ${self:site_config.site_secret_key}
) are output inprocess.env.site_secret_key
as[Object object]
where it should have been the string value associated with thesite_secret_key
value in the./config/${opt:stage}/site.yml
file.Note that using the following syntax works correctly:
${file(./config/${opt:stage}/site.yml):site_secret_key}
Additional Data
The text was updated successfully, but these errors were encountered: