Serverless deprecation warning on .env files

I am using serverless framework to deploy react web application. I’ve set up a CI/CD pipeline for deployment. when serverless template gets executed I am receiving several deprecation warnings.

Serverless: Deprecation warning: Detected ".env" files. In the next major release variables from ".env" files will be automatically loaded into the serverless build process. Set "useDotenv: true" to adopt that behavior now.
            More Info:
Serverless: Deprecation warning: Variables resolver reports following resolution errors:
              - Cannot resolve variable at "provider.profile": Value not found at "env" source
   From a next major this will be communicated with a thrown error.
            Set "variablesResolutionMode: 20210326" in your service config, to adapt to new behavior now
            More Info:

The way I understand these warnings, it is trying to load environment variables from .env file from the serverless directory. But I’ve stored my variables from other files(abc.config) and loading them to the serverless template through that file and not from the .env file. and for this reason I am getting these warnings.

Also I’ve used serverless-dotenv-plugin to use environment variables in .env file for local deployment and that’s why the .env file has to be there in the serverless directory. But for now loading variables from abc.config file is working fine and in the future, I want to load variables from the same file(abc.config). But in the future, if I use the same approach for environment variables, that will throw an error instead of giving a warning.

Questions 1: I am not sure how would I tackle this issue. because in the upcoming serverless version release this will throw an error.

Question 2: What if I install a specific serverless version. for example; npm install -g serverless@2.45.0 in that case, in the future will I still get these deprecation warnings? In theory, I’ll be still using the old serverless version and this version supports loading variables from other files. So I should not be getting these warnings. I can be wrong. but what should be the ideal approach to resolve these warnings ahead of time?

Any help would be greatly appreciated.
Thank you.

You should set the deprecation variables in your serverless.yml file and verify that serverless deploy is successful and the framework interpolates your variables as snaptube vidmate you intend.

Hey, have you figured out how to do that ?

Appvalley TutuApp Tweakbox