Major changes to serverless-dotenv-plugin

The Serverless Framework has a new variables engine starting in serverless@2.26.0. This is part of a larger initiative by the Serverless Framework team that will come into effect in serverless>=3.0.0.

The biggest impact with these changes is that plugins will not get initialized until after env variables are resolved. This means serverless-dotenv-plugin is no longer able to load environment variables in time for them to be used in your service file (i.e. serverless.yml). However, the plugin will continue to load environment variables into all your functions using dotenv.

If you need to load environment variables to be used in your service, you will either need to use the built-in dotenv functionality or wire up dotenv yourself. You can see an example of how to wire up dotenv yourself at neverendingqs/serverless-dotenv-example.

I’m happy to address any questions or comments in the discussions section on GitHub or below. I’m also happy to answer any Serverless Framework questions you may have at neverendingqs/ask-me-anything.

Software Developer | Lifelong Learner. neverendingqs.com