Skip to content

Commit cf28203

Browse files
authored
Merge pull request #66 from rh-aiservices-bu/fix/backend-fill
fix(migrations): skip inactive keys in litellm_key_alias backfill
2 parents 696e6ad + 22f087c commit cf28203

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

backend/src/lib/database-migrations.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,14 +637,16 @@ COMMENT ON COLUMN subscriptions.status_changed_by IS 'Existing subscriptions mig
637637
export const backfillLiteLLMKeyAlias = async (dbUtils: DatabaseUtils, liteLLMService: any) => {
638638
try {
639639
// Find all API keys that don't have litellm_key_alias set
640+
// Only process active keys to avoid 404s from inactive/revoked keys
640641
const keysToBackfill = await dbUtils.queryMany<{
641642
id: string;
642643
lite_llm_key_value: string;
643644
}>(
644645
`SELECT id, lite_llm_key_value
645646
FROM api_keys
646647
WHERE litellm_key_alias IS NULL
647-
AND lite_llm_key_value IS NOT NULL`,
648+
AND lite_llm_key_value IS NOT NULL
649+
AND is_active = true`,
648650
[],
649651
);
650652

0 commit comments

Comments
 (0)