supabase / storage

S3 compatible object storage service that stores metadata in Postgres
https://supabase.com/docs/guides/storage
Apache License 2.0
783 stars 111 forks source link

400 Bad request when using getPublicUrl #561

Open Wizzel1 opened 2 weeks ago

Wizzel1 commented 2 weeks ago

Bug report

Describe the bug

I have an app that displays multiple images in a list. Each of those images is requested via getPublicUrl like so:

export function getPreviewUrl(
  supabase: SupabaseClient<Database>,
  path_tokens: z.infer<typeof pathTokenSchema>,
) {
  try {
    const {
      data: { publicUrl },
    } = supabase.storage
      .from('thumbnails')
      .getPublicUrl(path_tokens.thumbnailPath, { download: true });
    return publicUrl;
  } catch (error) {
    if (error instanceof Error) {
      console.log('Error downloading image: ', error.message);
    }
    Sentry.captureException(error);
    return '';
  }
}

for some reason, sometimes a 400 Bad request error gets thrown but others load just fine. Any idea why this happens?

Expected behavior

I expected to be able to show my "thumbnails" for each image.

Screenshots

Unbenannt

System information

Additional context

Add any other context about the problem here.

fenos commented 2 weeks ago

Hello, can you please share more information about the error you are getting ex:

Thanks