diff --git a/deploy/lib/createFunctions.js b/deploy/lib/createFunctions.js index cb97f838..da4025db 100644 --- a/deploy/lib/createFunctions.js +++ b/deploy/lib/createFunctions.js @@ -155,7 +155,7 @@ module.exports = { params.runtime = this.validateRuntime(func, availableRuntimes, this.serverless.cli); // checking if there is custom_domains set on function creation. - if (func.custom_domains.length > 0) { + if (func.custom_domains && func.custom_domains.length > 0) { this.serverless.cli.log("WARNING: custom_domains are available on function update only. "+ "Redeploy your function to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/functions/how-to/add-a-custom-domain-name-to-a-function/") } diff --git a/info/lib/display.js b/info/lib/display.js index faf53b6f..e4a48641 100644 --- a/info/lib/display.js +++ b/info/lib/display.js @@ -1,5 +1,7 @@ "use strict"; +const yaml = require('js-yaml'); + module.exports = { displayInfo() { const configInput = this.serverless.configurationInput; @@ -17,13 +19,13 @@ module.exports = { ) { this.listContainers(namespace.id).then((containers) => { containers.forEach((container) => { - this.serverless.cli.log(JSON.stringify(container, null, "\t")); + this.serverless.cli.log(yaml.dump(container)); }); }); } else { this.listFunctions(namespace.id).then((functions) => { functions.forEach((func) => { - this.serverless.cli.log(JSON.stringify(func, null, "\t")); + this.serverless.cli.log(yaml.dump(func)); }); }); } diff --git a/provider/scalewayProvider.js b/provider/scalewayProvider.js index 6978eb36..3b2fe887 100644 --- a/provider/scalewayProvider.js +++ b/provider/scalewayProvider.js @@ -38,22 +38,36 @@ class ScalewayProvider { } setCredentials(options) { + // On serverless info command we do not want log pollution from authentication. + // This is necessary to use it in automated environment. + let hideLog = false; + if (this.serverless.configurationInput.service && this.serverless.configurationInput.service === 'serverlessInfo') { + hideLog = true; + } if (options['scw-token'] && options['scw-project']) { - this.serverless.cli.log('Using credentials from command line parameters'); + if (!hideLog) { + this.serverless.cli.log('Using credentials from command line parameters'); + } this.scwToken = options['scw-token']; this.scwProject = options['scw-project']; } else if (process.env.SCW_SECRET_KEY && process.env.SCW_DEFAULT_PROJECT_ID) { - this.serverless.cli.log('Using credentials from system environment'); + if (!hideLog) { + this.serverless.cli.log('Using credentials from system environment'); + } this.scwToken = process.env.SCW_SECRET_KEY; this.scwProject = process.env.SCW_DEFAULT_PROJECT_ID; } else if (process.env.SCW_TOKEN && process.env.SCW_PROJECT) { - this.serverless.cli.log('Using credentials from system environment'); - this.serverless.cli.log('NOTICE: you are using deprecated environment variable notation,'); - this.serverless.cli.log('please update to SCW_SECRET_KEY and SCW_DEFAULT_PROJECT_ID'); + if (!hideLog) { + this.serverless.cli.log('Using credentials from system environment'); + this.serverless.cli.log('NOTICE: you are using deprecated environment variable notation,'); + this.serverless.cli.log('please update to SCW_SECRET_KEY and SCW_DEFAULT_PROJECT_ID'); + } this.scwToken = process.env.SCW_TOKEN; this.scwProject = process.env.SCW_PROJECT; } else { - this.serverless.cli.log('Using credentials from yml'); + if (!hideLog) { + this.serverless.cli.log('Using credentials from yml'); + } this.scwToken = this.serverless.service.provider.scwToken || ''; this.scwProject = this.serverless.service.provider.scwProject || ''; }