Where to put "useDotenv: true" in serverless.yml file?

Viewed 6347

I was using serverless templates and all worked fine until suddenly all my deployments started ignoring .env files.

I searched through the documentation and it says that if I want to use the environment variables from .env files I now have to add useDotenv: true in my serverless.yml file. So I did:

app: xxx
org: xxx
useDotenv: true 

There was no effect.

My serverless.yml file contained nothing else before but the app and org variables.

Where do I need to add the seDotenv: true in order to make it read my .env variables?

1 Answers

You should put it at the root of your serverless.yml file.

I have mine just after the service attribute :

service: lb-courses
useDotenv: true
plugins:
  - serverless-offline
...
Related