microsoft / microsoft/lage

Does not load env vars from `.env`

Open
#908 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
816
Forks
88
PR merge metrics
No merged PRs in 30d

Description

When I try to configure the backfill cache by creating a .env file in the parent folder of my project, it did not use the cache. If I set the environment variables on the command line, it does use the cache. From this I infer that it is not loading the .env file, even though the documentation seems to imply that it should be doing this automatically

It looks like .env is only loaded if you import the backfill package, but lage does not do this (any more?). I guess at some point lage changed to bypass the main backfill package and lost the .env loading logic.

The .env loading is referenced on this page:

https://microsoft.github.io/lage/docs/guides/remote-cache

Either the .env loading logic should be restored or the docs should be updated not to say that .env will be loaded automatically.

Workaround

You can update lage.config.cjs to use a dotenv library to load the .env yourself. For example by adding dotenv-mono as a dependency and running require('dotenv-mono').load();

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the remote-cache documentation and the lage.config.cjs workaround, then trace how lage loads configuration and whether it imports the backfill package. Verify the behavior with a .env file in the project’s parent folder and command-line environment variables. Done means either automatic .env loading works as documented or the remote-cache documentation no longer promises it.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.