DEV Community

Mark Tse
Mark Tse

Posted on • Originally published at on

Major changes to serverless-dotenv-plugin

The Serverless Framework has a new variables engine starting inserverless@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 meansserverless-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 dotenvfunctionality or wire up dotenv yourself. You can see an example of how to wire up dotenvyourself atneverendingqs/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.

Top comments (0)