calcom/cal.diy · error · HttpCode

Credentials not found

Error message

Credentials not found

What it means

Thrown when the booking's owner has no alby_payment credential row (the nested credentials select returned an empty array). Without the credential key the webhook cannot retrieve the Svix secret to verify the signature. Returns HTTP 204.

Source

Thrown at packages/app-store/alby/api/webhook.ts:76

        booking: {
          select: {
            user: {
              select: {
                credentials: {
                  where: {
                    type: "alby_payment",
                  },
                },
              },
            },
          },
        },
      },
    });

    if (!payment) throw new HttpCode({ statusCode: 204, message: "Payment not found" });
    const key = payment.booking?.user?.credentials?.[0].key;
    if (!key) throw new HttpCode({ statusCode: 204, message: "Credentials not found" });

    const parseCredentials = albyCredentialKeysSchema.safeParse(key);
    if (!parseCredentials.success) {
      console.error(parseCredentials.error);
      throw new HttpCode({ statusCode: 500, message: "Credentials not valid" });
    }

    const credentials = parseCredentials.data;

    const albyInvoice = await parseInvoice(bodyAsString, parsedHeaders, credentials.webhook_endpoint_secret);
    if (!albyInvoice) throw new HttpCode({ statusCode: 204, message: "Invoice not found" });
    if (albyInvoice.amount !== payment.amount) {
      throw new HttpCode({ statusCode: 400, message: "invoice amount does not match payment amount" });
    }

    const traceContext = distributedTracing.createTrace("alby_webhook", {
      meta: { paymentId: payment.id, bookingId: payment.bookingId },
    });

View on GitHub (pinned to 176037d0af)

Solutions

  1. Ensure the booking owner still has an alby_payment credential row.
  2. Re-install Alby for that user if it was removed.
  3. Reassign the booking's payment to a user who holds the Alby credential.
Defensive patterns

Strategy: validation

Validate before calling

const key = payment?.booking?.user?.credentials?.[0]?.key;
if (!key) {
  // surface 'reinstall Alby for the booking owner' rather than 204 silent ignore
}

Type guard

const hasCredentialKey = (k: unknown): k is Record<string, unknown> =>
  typeof k === 'object' && k !== null;

Prevention

When it happens

Trigger: Booking user uninstalled Alby after the invoice was created; the credential row was deleted; the booking belongs to a user who never connected Alby (e.g. a managed/organizer booking).

Common situations: Uninstall-then-delayed-webhook; admin booking where the organizer lacks the Alby credential; credential migrated or wiped.

Related errors


AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12). Data as JSON: /api/errors/3f1901ff7d7258ef. Report an issue: GitHub.