langfuse/langfuse · error

${authCheck.error}

Error message

${authCheck.error}

What it means

HTTP 401 auth failure on the org projects endpoint: the Authorization header failed verification; the response body interpolates authCheck.error, which explains the specific reason (missing header, invalid key, etc.).

Source

Thrown at web/src/pages/api/public/organizations/projects/index.ts:32

) {
  await runMiddleware(req, res, cors);

  if (req.method !== "GET") {
    logger.error(
      `Method not allowed for ${req.method} on /api/public/organizations/projects`,
    );
    return res.status(405).json({
      error: "Method not allowed",
    });
  }

  // CHECK AUTH
  const authCheck = await new ApiAuthService(
    prisma,
    redis,
  ).verifyAuthHeaderAndReturnScope(req.headers.authorization);
  if (!authCheck.validKey) {
    return res.status(401).json({
      error: authCheck.error,
    });
  }
  // END CHECK AUTH

  // Check if using an organization API key
  if (
    authCheck.scope.accessLevel !== "organization" ||
    !authCheck.scope.orgId
  ) {
    return res.status(403).json({
      error:
        "Invalid API key. Organization-scoped API key required for this operation.",
    });
  }

  if (
    !hasEntitlementBasedOnPlan({

View on GitHub (pinned to 59d92c7cf3)

Solutions

  1. Read the interpolated error message for the exact cause
  2. Send 'Authorization: Basic base64(pk:sk)' with an org key
  3. Verify key validity in organization settings
Defensive patterns

Strategy: validation

Validate before calling

const auth = 'Basic ' + Buffer.from(`${pk}:${sk}`).toString('base64');
if (!pk || !sk) throw new Error('Missing credentials');

Try / catch

try { ... } catch (e) { if (e.status === 401) reportAuthError(e.body.error); }

Prevention

When it happens

Trigger: Calling GET /api/public/organizations/projects without a valid Basic auth header or with an invalid/revoked key.

Common situations: Missing Authorization header, wrong key, wrong host.

Related errors


AI-assisted analysis of langfuse/langfuse@59d92c7cf3 (2026-08-27). Data as JSON: /api/errors/9760016d42562554. Report an issue: GitHub.