Skip to content

fix: add OC_USER and OC_EMAIL to dev-env .env.local#1151

Merged
Gkrumbach07 merged 1 commit intoambient-code:mainfrom
patjlm:fix/dev-env-oc-user
Apr 2, 2026
Merged

fix: add OC_USER and OC_EMAIL to dev-env .env.local#1151
Gkrumbach07 merged 1 commit intoambient-code:mainfrom
patjlm:fix/dev-env-oc-user

Conversation

@patjlm
Copy link
Copy Markdown
Contributor

@patjlm patjlm commented Apr 2, 2026

Summary

  • make dev-env now includes OC_USER and OC_EMAIL in the generated .env.local
  • Fixes 401 errors when creating workspaces from the local frontend dev server (make dev COMPONENT=frontend)
  • Aligns local dev setup with the kind overlay (frontend-test-patch.yaml) which already sets these vars

Root cause

The frontend proxy (buildForwardHeaders in auth.ts) uses OC_USER to set the X-Forwarded-User header. Without it, the backend's forwardedIdentityMiddleware cannot populate userID in the Gin context, and CreateProject fails with "no user subject found in token".

Test plan

  • Run make kind-up LOCAL_IMAGES=true
  • Run make dev-env and verify components/frontend/.env.local contains OC_USER and OC_EMAIL
  • Run make dev COMPONENT=frontend
  • Create a new workspace from localhost:3000 — should succeed (previously returned 401)

🤖 Generated with Claude Code

The dev-env target generates .env.local with OC_TOKEN but was missing
OC_USER and OC_EMAIL. Without these, the frontend proxy does not set
X-Forwarded-User headers, causing the backend to reject write operations
(e.g. workspace creation) with 401 "no user subject found in token".

The kind overlay already sets these env vars for the in-cluster frontend,
so this aligns the local dev setup with the cluster behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

📝 Walkthrough

Walkthrough

The Makefile's dev-env target now exports two additional OpenShift identity environment variables (OC_USER and OC_EMAIL) into the frontend .env.local configuration alongside the existing OC_TOKEN setup.

Changes

Cohort / File(s) Summary
Build Configuration
Makefile
Extended dev-env target to populate OC_USER (serviceaccount reference) and OC_EMAIL (test-user@vteam.local) in frontend environment file, complementing existing OC_TOKEN logic.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits format (fix: scope description) and accurately describes the main change: adding OC_USER and OC_EMAIL environment variables to dev-env configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Performance And Algorithmic Complexity ✅ Passed Change adds two static string assignments (OC_USER, OC_EMAIL) to dev-env Makefile target with constant-time O(1) operations and no unbounded growth.
Security And Secret Handling ✅ Passed PR introduces no security vulnerabilities. OC_USER and OC_EMAIL are non-sensitive hardcoded server-side values. OC_TOKEN uses secure pattern via K8s secret, not exposed client-side.
Kubernetes Resource Safety ✅ Passed PR only modifies Makefile dev-env target with environment variables; no Kubernetes manifests or resource configurations present.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@patjlm
Copy link
Copy Markdown
Contributor Author

patjlm commented Apr 2, 2026

Or I (and claude) may have missed some kind of setup 😉

@ambient-code ambient-code bot added this to the Review Queue milestone Apr 2, 2026
@Gkrumbach07 Gkrumbach07 merged commit 26687af into ambient-code:main Apr 2, 2026
7 checks passed
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.

2 participants