fix: update env template to use LANGFUSE_BASE_URL#1701
Merged
hassiebp merged 2 commits intoJun 11, 2026
Conversation
hassiebp
reviewed
Jun 11, 2026
hassiebp
left a comment
Collaborator
There was a problem hiding this comment.
Thanks Milana! Could you please update the PR title to follow semantic commit convention? See also for other commits in this repo
09ff509 to
697ec55
Compare
Collaborator
|
Thanks for your contribution, @milanagm 🥳 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes LFE-10249
What does this PR do?
A contributor who follows CONTRIBUTING.md set up langfuse-python and to run the E2E test suite hits a KeyError before any test runs, because .env.template does not include LANGFUSE_BASE_URL, which the test infrastructure hard-requires.
Root cause
LANGFUSE_BASE_URL is the canonical env var in v4; LANGFUSE_HOST is deprecated (AGENTS.md:131, code_review.md:14).
The SDK client itself works with either — reads LANGFUSE_BASE_URL first, falls back to LANGFUSE_HOST (langfuse/_client/client.py:258-263).
But the test infra has no fallback: tests/support/api_wrapper.py:19 uses os.environ["LANGFUSE_BASE_URL"] (subscript → KeyError if unset). tests/support/utils.py:72 passes os.environ.get("LANGFUSE_BASE_URL") (→ None), which then hits that subscript.
.env.template ships only LANGFUSE_HOST, never LANGFUSE_BASE_URL.
CONTRIBUTING.md:39 tells contributors to set up E2E env vars "based on .env.template".
5 of 8 files in tests/e2e/ call get_api() / LangfuseAPI, so all of them fail without the var.
Steps to reproduce
cp .env.template .env and fill in keys (per CONTRIBUTING).
Start a local Langfuse server.
Run uv run --frozen pytest -n 4 --dist worksteal tests/e2e -m "not serial_e2e".
Result: errors/failures originating from KeyError('LANGFUSE_BASE_URL').
Minimal repro (no server needed):
$ env -i LANGFUSE_HOST=http://localhost:3000/ \
KeyError: 'LANGFUSE_BASE_URL'
Greptile Summary
This PR fixes a contributor-facing DX issue:
.env.templatewas missingLANGFUSE_BASE_URL(the canonical v4 env var), causing aKeyErrorbefore any E2E test ran when following the CONTRIBUTING.md setup steps. The fix addsLANGFUSE_BASE_URLas the primary entry and retainsLANGFUSE_HOSTwith a deprecation comment.LANGFUSE_BASE_URL=http://localhost:3000to.env.template, matching whattests/support/api_wrapper.py:19requires viaos.environ["LANGFUSE_BASE_URL"].LANGFUSE_HOSTin the template with an inline comment marking it deprecated, which preserves backward-compat awareness but introduces a minor risk (see comment).Confidence Score: 5/5
Safe to merge — a one-line template addition that unblocks E2E tests for new contributors without touching any runtime code.
The change is confined to
.env.template, adds exactly the missing variable thattests/support/api_wrapper.pyhard-requires, and introduces no logic changes. The only minor concern is the inline comment on the deprecatedLANGFUSE_HOSTline, which could confuse non-python-dotenv tooling.No files require special attention;
.env.templateis the only changed file and the fix is straightforward.Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "add LANGFUSE_BASE_URL to .env.template s..." | Re-trigger Greptile