{"record":{"id":"3f1901ff7d7258ef","repo":"calcom/cal.diy","slug":"credentials-not-found","errorCode":null,"errorMessage":"Credentials not found","messagePattern":"Credentials not found","errorType":"http","errorClass":"HttpCode","httpStatus":204,"severity":"error","filePath":"packages/app-store/alby/api/webhook.ts","lineNumber":76,"sourceCode":"        booking: {\n          select: {\n            user: {\n              select: {\n                credentials: {\n                  where: {\n                    type: \"alby_payment\",\n                  },\n                },\n              },\n            },\n          },\n        },\n      },\n    });\n\n    if (!payment) throw new HttpCode({ statusCode: 204, message: \"Payment not found\" });\n    const key = payment.booking?.user?.credentials?.[0].key;\n    if (!key) throw new HttpCode({ statusCode: 204, message: \"Credentials not found\" });\n\n    const parseCredentials = albyCredentialKeysSchema.safeParse(key);\n    if (!parseCredentials.success) {\n      console.error(parseCredentials.error);\n      throw new HttpCode({ statusCode: 500, message: \"Credentials not valid\" });\n    }\n\n    const credentials = parseCredentials.data;\n\n    const albyInvoice = await parseInvoice(bodyAsString, parsedHeaders, credentials.webhook_endpoint_secret);\n    if (!albyInvoice) throw new HttpCode({ statusCode: 204, message: \"Invoice not found\" });\n    if (albyInvoice.amount !== payment.amount) {\n      throw new HttpCode({ statusCode: 400, message: \"invoice amount does not match payment amount\" });\n    }\n\n    const traceContext = distributedTracing.createTrace(\"alby_webhook\", {\n      meta: { paymentId: payment.id, bookingId: payment.bookingId },\n    });","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/packages/app-store/alby/api/webhook.ts#L58-L94","documentation":"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.","triggerScenarios":"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).","commonSituations":"Uninstall-then-delayed-webhook; admin booking where the organizer lacks the Alby credential; credential migrated or wiped.","solutions":["Ensure the booking owner still has an alby_payment credential row.","Re-install Alby for that user if it was removed.","Reassign the booking's payment to a user who holds the Alby credential."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const key = payment?.booking?.user?.credentials?.[0]?.key;\nif (!key) {\n  // surface 'reinstall Alby for the booking owner' rather than 204 silent ignore\n}","typeGuard":"const hasCredentialKey = (k: unknown): k is Record<string, unknown> =>\n  typeof k === 'object' && k !== null;","tryCatchPattern":null,"preventionTips":["Keep the booking owner's Alby credential installed until all webhooks are processed.","Do not uninstall Alby while payments are pending.","Reassign payments to a user holding the credential if needed."],"tags":["alby","webhook","credential","missing-credential"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}