With 1 user and couple of of photos engress cache limit exceed to 200%
hi can anyone help me out here, I have only 1 user and couple of photos uploaded and fetched now my egress caching cross my limit I am quite affraid now. Besides I am new with supabase, please guide me to fix the issue.
export async function uploadAvatar(userId: string, uri: string) {
const ext = uri.split('.').pop()?.toLowerCase() ?? 'jpg';
const mimeType = ext === 'png' ? 'image/png' : 'image/jpeg';
const fileName = `${userId}_${Date.now()}.${ext}`;
const formData = new FormData();
formData.append('file', { uri, type: mimeType, name: fileName } as any);
const { data: session } = await supabaseClient.auth.getSession();
const response = await fetch(`${SUPABASE_URL}/storage/v1/object/avatars/${fileName}`, {
method: 'POST',
headers: {
Authorization: `Bearer ${session?.session?.access_token}`,
'x-upsert': 'true',
'Cache-Control': 'public, max-age=31536000, immutable',
},
body: formData,
});
if (!response.ok) {
const errBody = await response.text().catch(() => '');
console.error('[profileService] uploadAvatar failed:', response.status, errBody);
return { error: new Error('Upload failed') };
}
const { data: urlData } = supabaseClient.storage.from('avatars').getPublicUrl(fileName);
return { publicUrl: urlData.publicUrl };
}
Posted Jun 25, 2026, 6:55 AM UTC
36