fix: avatar/logo display diagnostics and upload error handling
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m31s
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m31s
Add error logging to silent catch blocks in avatar/logo URL generation, show user avatar on admin member detail page, and surface specific error messages for upload failures (CORS/network issues) instead of generic errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import { UserRole } from '@prisma/client'
|
||||
import { router, protectedProcedure, adminProcedure, superAdminProcedure, publicProcedure } from '../trpc'
|
||||
import { sendInvitationEmail, sendMagicLinkEmail } from '@/lib/email'
|
||||
import { hashPassword, validatePassword } from '@/lib/password'
|
||||
import { attachAvatarUrls } from '@/server/utils/avatar-url'
|
||||
import { attachAvatarUrls, getUserAvatarUrl } from '@/server/utils/avatar-url'
|
||||
import { logAudit } from '@/server/utils/audit'
|
||||
import { generateInviteToken, getInviteExpiryHours, getInviteExpiryMs } from '@/server/utils/invite'
|
||||
|
||||
@@ -353,7 +353,8 @@ export const userRouter = router({
|
||||
},
|
||||
},
|
||||
})
|
||||
return user
|
||||
const avatarUrl = await getUserAvatarUrl(user.profileImageKey, user.profileImageProvider)
|
||||
return { ...user, avatarUrl }
|
||||
}),
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,8 @@ export async function getUserAvatarUrl(
|
||||
const providerType = (profileImageProvider as StorageProviderType) || 's3'
|
||||
const provider = createStorageProvider(providerType)
|
||||
return await provider.getDownloadUrl(profileImageKey)
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.error('[AvatarURL] Failed to generate URL for key:', profileImageKey, error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ export async function getProjectLogoUrl(
|
||||
const providerType = (logoProvider as StorageProviderType) || 's3'
|
||||
const provider = createStorageProvider(providerType)
|
||||
return await provider.getDownloadUrl(logoKey)
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.error('[LogoURL] Failed to generate URL for key:', logoKey, error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user