Funktionen: Stripe-Sitzungs-ID bis 128 Zeichen, keine Rohmeldungen beim Bestellen

Live-Fehler: cs_live-Sitzungs-IDs (~66 Zeichen) passten nicht in das Feld
portalFeatures.stripeSessionId (64), die Bestellung brach nach dem Anlegen
der Stripe-Sitzung ab und der Kunde sah die Appwrite-Meldung.
- Setup-Skript: Feld 128 Zeichen, bestehendes Feld wird per ensureStringSize vergroessert
- Fehler von Appwrite oder unerwartete Fehler: Log + verstaendlicher Hinweis

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Opus 5.5 committed 2026-09-30 17:58:44 +00:00
1 parent 4b7f73abba
commit b45108c1de
4 files changed
+54 -7

No files matched your search

+21 -1
View File
@@ -63,6 +63,24 @@ async function waitForAttributes(collectionId, keys, maxSec = 60) {
const col = (id) => `/databases/${databaseId}/collections/${id}`
/**
* Vergroessert ein bestehendes String-Attribut, falls es kleiner als size ist (ensureCollection
* ueberspringt vorhandene Attribute und prueft ihre Groesse nicht). Verkleinern tut es nie.
*/
async function ensureStringSize(collectionId, key, size) {
const attr = await aw(`${col(collectionId)}/attributes/${key}`)
if (attr.size >= size) {
console.log(`= ${collectionId}.${key} Groesse ${attr.size} (ok)`)
return
}
await aw(`${col(collectionId)}/attributes/string/${key}`, {
method: 'PATCH',
body: { required: Boolean(attr.required), default: attr.default ?? null, size },
})
await waitForAttributes(collectionId, [key])
console.log(`+ ${collectionId}.${key} Groesse ${attr.size} -> ${size}`)
}
async function ensureCollection(id, name, attributes, indexes) {
// Keine Dokument-Permissions: Zugriff ausschliesslich ueber den Server-API-Key
await ensure(`Collection ${id}`, () =>
@@ -260,7 +278,7 @@ await ensureCollection(
{ type: 'string', key: 'state', size: 16 },
{ type: 'string', key: 'siteKey', size: 16 },
{ type: 'string', key: 'ticketId', size: 64 },
{ type: 'string', key: 'stripeSessionId', size: 64 },
{ type: 'string', key: 'stripeSessionId', size: 128 },
{ type: 'string', key: 'stripeInvoiceId', size: 64 },
{ type: 'string', key: 'invoiceUrl', size: 500 },
{ type: 'datetime', key: 'orderedAt' },
@@ -279,6 +297,8 @@ await ensureCollection(
{ key: 'idx_session', type: 'key', attributes: ['stripeSessionId'] },
]
)
// Live-Fehler 30.09.2026: cs_live-Sitzungs-IDs (~66 Zeichen) passten nicht in 64
await ensureStringSize('portalFeatures', 'stripeSessionId', 128)
// News-Pinnwand: Beitraege je Projekt
await ensureCollection(