Spell out which Coolify backup vars belong on AIGen vs xAIGen.

A URL in BACKUP_INGEST_TOKEN was treated as a missing token. Errors now say to put the URL on AIGen and the same secret on both apps.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-01 19:14:34 -05:00
co-authored by Cursor
parent 8b414044cd
commit f25e1bcc8a
4 changed files with 65 additions and 13 deletions
@@ -1,17 +1,17 @@
import { readFileSync } from 'node:fs'
import { isXaigenStudio } from '~/utils/videoModels'
import { backupStudioConfigError, backupStudioTarget } from '~/server/utils/backupStudio'
import { assertLibraryOwner, getStill, stillPath } from '~/server/utils/library'
export default defineEventHandler(async (event) => {
if (isXaigenStudio()) {
throw createError({ statusCode: 404, statusMessage: 'Not found' })
}
const config = useRuntimeConfig()
const url = String(config.backupStudioUrl || process.env.BACKUP_STUDIO_URL || '').replace(/\/$/, '')
const token = String(config.backupStudioToken || process.env.BACKUP_STUDIO_TOKEN || '').trim()
if (!url || !token) {
throw createError({ statusCode: 503, statusMessage: 'Backup studio is not configured' })
const missing = backupStudioConfigError()
if (missing) {
throw createError({ statusCode: 503, statusMessage: missing })
}
const { url, token } = backupStudioTarget()
const { owner } = assertLibraryOwner(event)
const id = String(getRouterParam(event, 'id') || '')
const still = getStill(owner, id)
@@ -31,7 +31,7 @@ export default defineEventHandler(async (event) => {
const message = await res.text().catch(() => '')
throw createError({
statusCode: res.status === 401 ? 502 : res.status,
statusMessage: message || 'Backup studio refused the still'
statusMessage: message || 'xAIGen refused the still. Check BACKUP_INGEST_TOKEN matches AIGen BACKUP_STUDIO_TOKEN.'
})
}
return { ok: true }