Skip to content

Conversation

@slayoffer
Copy link
Contributor

Summary

  • Add HINDSIGHT_CP_DATAPLANE_API_KEY env var support to control plane
  • Propagate Authorization header to dataplane API in all proxy routes

Problem

Control plane proxy routes never sent an Authorization header to the dataplane API. With tenant extension active, all GUI requests failed with "Invalid API key".

Solution

  1. Add getDataplaneHeaders() helper in hindsight-client.ts:
export function getDataplaneHeaders(additional?: Record<string, string>) {
  const headers: Record<string, string> = { ...additional };
  if (process.env.HINDSIGHT_CP_DATAPLANE_API_KEY) {
    headers["Authorization"] = \`Bearer \${process.env.HINDSIGHT_CP_DATAPLANE_API_KEY}\`;
  }
  return headers;
}
  1. Update all API route handlers to use getDataplaneHeaders():
// Before
fetch(url, { method: "GET" })

// After  
fetch(url, { method: "GET", headers: getDataplaneHeaders() })

Configuration

# In control plane .env
HINDSIGHT_CP_DATAPLANE_API_KEY=your-dataplane-api-key

Files modified

  • src/lib/hindsight-client.ts - Add helper function
  • src/app/api/**/*.ts - Update all route handlers

Test plan

  • Control plane works without env var (backwards compatible)
  • Control plane works with tenant extension when env var is set
  • All proxy routes pass auth header correctly

🤖 Generated with Claude Code

The control plane proxy routes never sent an Authorization header to
the dataplane API. With the tenant extension active, all GUI requests
failed with "Invalid API key".

Add HINDSIGHT_CP_DATAPLANE_API_KEY env var support to hindsight-client.ts
and propagate auth headers to both SDK clients and all direct fetch routes.
Copy link
Collaborator

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nicoloboschi nicoloboschi merged commit 03bf13e into vectorize-io:main Jan 30, 2026
17 of 26 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