Skip to content

Send LML_API_KEY bearer header on all LML calls#535

Merged
jakebromberg merged 4 commits into
mainfrom
feature/lml-bearer-header
Apr 27, 2026
Merged

Send LML_API_KEY bearer header on all LML calls#535
jakebromberg merged 4 commits into
mainfrom
feature/lml-bearer-header

Conversation

@jakebromberg
Copy link
Copy Markdown
Member

Summary

  • Injects Authorization: Bearer ${LML_API_KEY} at the lmlFetch chokepoint in apps/backend/services/lml/lml.client.ts. Single change covers all 7 LML calls (lookup, releases, artist, entity, track-releases, validate-track, streaming-check, library search).
  • When LML_API_KEY is unset or empty, no Authorization header is sent. Behavior unchanged in dev environments.
  • 5 new unit tests (header on POST, GET, absent when env unset, absent when empty, preserves caller-set headers).

This is PR #2 in the LML auth rollout. PR #1: WXYC/library-metadata-lookup#165 (merged). LML's LML_REQUIRE_AUTH defaults to false, so this PR is safe to deploy ahead of the flag flip.

Closes #534

Test plan

  • npm run test:unit — 1097 passed (22 in lml.client.test.ts including the 5 new ones)
  • npm run typecheck — clean
  • npm run lint on changed files — no new issues
  • Pre-push hook will fail until Send LML_API_KEY bearer header on all LML calls #535 (lint baseline cleanup) lands; rebase afterwards
  • Set LML_API_KEY in EC2 env to match LML
  • Deploy and verify /api/v1/streaming-check from Backend still works (should be no-op since LML's flag is off)

Injects Authorization: Bearer ${LML_API_KEY} at the lmlFetch chokepoint in apps/backend/services/lml/lml.client.ts so every call to LML carries the bearer when the env var is set. When unset or empty, no Authorization header is added — behavior is unchanged in dev environments without the var.

LML rolls out enforcement gradually (LML_REQUIRE_AUTH defaults false on the server), so this PR is safe to deploy ahead of the flag flip.

Closes #534
@jakebromberg jakebromberg merged commit 71808c3 into main Apr 27, 2026
4 checks passed
@jakebromberg jakebromberg deleted the feature/lml-bearer-header branch April 27, 2026 18:57
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

Successfully merging this pull request may close these issues.

Send LML_API_KEY bearer header on all LML calls

1 participant