Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env being removed after being generated #11

Open
kraiovsky opened this issue Aug 30, 2019 · 3 comments
Open

.env being removed after being generated #11

kraiovsky opened this issue Aug 30, 2019 · 3 comments

Comments

@kraiovsky
Copy link

running

> sls env generate

first creates and then removes just generated .env. Sample output:

Serverless: DOTENV: Could not find .env file.
Serverless: Creating .env file...
Serverless: Removed .env file

same happens for sls package and other commands which seems to be expected according to after:deploy hooks, but shouldn't happen for a manual generation?

Running serverless v1.51.0

@kraiovsky
Copy link
Author

Looked through the code and it seems to be working as designed.
In my case, though, I run the app both as a server (with Koa + serverless-http) and as a Lambda function. I keep env variables in environment.yml, generate single .env which is used by both.
So, keeping .env file is important.

I created a pull request to accept an option sls env generate -keepEnvFile to keep it: #12

@tlimp
Copy link
Contributor

tlimp commented Sep 19, 2019

Thing is, it's kind of going against the purpose of having no unencrypted credentials longer than necessary on your file system.
We'll have a look into it and coming back to you as soon as possible.

@jim-spot
Copy link

jim-spot commented Aug 6, 2024

In my case I need the ability to use secrets in a Lambda@Edge function. Since it doesn't support environment variables, the only way you can really get this to work is to include a .env file with the deployment. I think a -packageEnvFile option would be really nice to have in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants