AWS "invoke local" region issue?

Hi all!!

I am facing with a little issue using Serverless framework. I have a serverless.yml file with a region configured (eu-west-1). I am testing the lambda code (python 3.8) locally using sls invoke local -f <service_name>. The lambda uses the boto3 library to access to the ssm service where I store some secrets (database credentials, for example). The problem is that the “invoke local” function doesn’t seem to use neither the region in the serverless.yaml nor the region in the ~/.aws/config file (boto3 uses this configuration file by default or an environment variable called AWS_DEFAULT_REGION). I know I can use the "invoke local -r " and it works properly but IMO it should use the region configured in the serverless.yml file or the region in the aws config file.

Is this a bug or is this the default behaviour? If this is the normal behaviour then, why??

Thanks a lot!
Fran

Hi Fran,

As you said, it should work with the region configured in the serverless.yaml, can you please share your code? Usually I’m using serverless-dotenv-plugin, have you tried it?

Bye!

Hi Marco,

I opened an issue in GitHub and it seems to be a bug (the serverless.yml that I am using is in the issue). Here is the link: https://github.com/serverless/serverless/issues/7929

Thanks!!
Fran