rurri / serverless-resources-env

Serverlss framework plugin, which after a deploy, fetches cloudformation resource identifiers and sets them on AWS lambdas, and creates local ./.serverless-resources-env/.<region>_<stage>_<function-name> file
MIT License
20 stars 7 forks source link

Error deploying when environment is defined at function level #4

Closed mzuniga84 closed 6 years ago

mzuniga84 commented 7 years ago

I'm getting an error when trying to deploy a function with environment defined.

This is my function definition:

functions: processor: handler: functions/processor/handler.handler events:

The error I'm getting is: Expected params.Environment.Variables['MAX_NUMBER_OF_MESSAGES'] to be a string

rurri commented 6 years ago

HI @mzuniga84 This can be fixed by making MAX_NUMBER_OF_MESSAGES: "10". Since env variables will end up as strings anyways.

In code you will need to parse this into an int.

const maxMessages = parseInt(process.env. MAX_NUMBER_OF_MESSAGES)