question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App can not find the env variables

See original GitHub issue

I am trying to create an .env file as part of Github Action workflow as shown below.

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - name: Install Node.js
        uses: actions/setup-node@v1
        with:
          node-version: "10.x"
      - name: Install npm dependencies
        run: npm install
      - name: Create the .env file
        uses: SpicyPizza/create-envfile@v1
        with:
          envkey_QUERY_LIMIT: 20
          envkey_GOOGLE_RECAPTCHA_SECRET_KEY: ${{ secrets.GOOGLE_RECAPTCHA_SECRET_KEY }}
          file_name: .env
      - name: Run build task
        run: npm run build

The build job is successful but my app can not read the .env after deployment, on the server that is. Any ideas why?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
Javasciptcommented, Jun 21, 2021

I had the same issue while deploying to Heroku using akhileshns/heroku-deploy. I figured out that if you put your .env in .gitignore, the file will be properly created during the workflow execution, but it will never make it to your Heroku app. You might want to use a different name for your production .env.

0reactions
AngelOnFiracommented, Oct 26, 2021

(side note: how do you make it spicy btw, chilli or hot salami?)

We have yet to conduct research into what we mean 😛

I had the same problem and noticed the .env file is created with root as the owner, I was able to fix it by adding a step to change the owner to current user.

Since it’s being run in the Docker container, I’m unsure on how best to let the user be defined. Feel free to create a separate issue if this is important!

I think the items in this issue have been resolved, so I’ll close it. Feel free to re-open it if they are still a problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[FIX] System Could not Find Environment Option that was ...
Method 3: Add Frequently Missing Variables in Safe Mode ; Restart your system with Safe Mode Enabled Boot using Safe Mode ; Click...
Read more >
c# - .NET Core 3.1 application not finding environment variable
I cannot get my .NET Core 3.1 console application to recognize my custom system environment variables. I can pull and print other system ......
Read more >
Cannot find Edit Environment Variables Window in Windows ...
Cannot find Edit Environment Variables Window in Windows 10 Home. Hi! I am new to this forum and looking for some help please!...
Read more >
Introduction to environment variables - CircleCI
You can find step-by-step instructions of this process on the Environment variables page. The variable values are neither readable nor editable in the...
Read more >
Create and Modify Environment Variables on Windows
Create and Modify Environment Variables on Windows · On the Windows taskbar, right-click the Windows icon and select System. · In the Settings...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found