Created
June 9, 2017 13:34
-
-
Save guillaume/9b4e252f75fe3fa0c7eb9d570bf0c259 to your computer and use it in GitHub Desktop.
serverless offline bug with env variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const printFoo = (event, context, callback) => { | |
const response = { | |
statusCode: 200, | |
body: JSON.stringify(process.env.FOO) | |
}; | |
callback(null, response); | |
// Use this code if you don't use the http event with the LAMBDA-PROXY integration | |
// callback(null, { message: 'Go Serverless v1.0! Your function executed successfully!', event }); | |
}; | |
module.exports.foo = printFoo; | |
module.exports.bar = printFoo; | |
module.exports.baz = printFoo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: my-service | |
# You can pin your service to only deploy with a specific Serverless version | |
# Check out our docs for more details | |
# frameworkVersion: "=X.X.X" | |
plugins: | |
- serverless-offline | |
provider: | |
name: aws | |
runtime: nodejs6.10 | |
environment: | |
FOO: foo | |
# you can define service wide environment variables here | |
functions: | |
foo: | |
handler: handler.foo | |
events: | |
- http: | |
method: get | |
path: /foo | |
bar: | |
handler: handler.bar | |
events: | |
- http: | |
method: get | |
path: /bar | |
environment: | |
FOO: bar | |
baz: | |
handler: handler.baz | |
events: | |
- http: | |
method: get | |
path: /baz | |
environment: | |
FOO: baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl 'http://localhost:3000/foo' | |
curl 'http://localhost:3000/bar' | |
curl 'http://localhost:3000/baz' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
should print