serverless / examples

Serverless Examples – A collection of boilerplates and examples of serverless architectures built with the Serverless Framework on AWS Lambda, Microsoft Azure, Google Cloud Functions, and more.
https://www.serverless.com/examples/
Other
11.36k stars 4.47k forks source link

Variables from Javascript module, instance of serverless undefined #260

Open tbenade opened 6 years ago

tbenade commented 6 years ago

HI, trying to make use of variables exported from a JS file as I need access to the serverless object.

module.exports = (serverless) => {
  serverless.cli.consoleLog('You can access Serverless config and methods as well!'); //<-- always null for me

  return {
    property1: 'some value',
    property2: 'some other value'
  }
}

in serverless.yml

stackTags: ${file(./lib/stackTags.js)}

from https://serverless.com/framework/docs/providers/aws/guide/variables/#reference-variables-in-javascript-files

barretthinson commented 6 years ago

Same issue for me, bump

tbenade commented 6 years ago

Hi @barretthinson bump your version, looks like a fix went out in 1.27, not tried it yet myself though. https://github.com/serverless/serverless/pull/4743

barretthinson commented 6 years ago

Thanks, can confirm that bumping the version was indeed all it took, works great now