You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Supabase Storage更新图片报404:请求路径缺失/public/问题排查

问题原因

你的请求路径缺少public/前缀,Supabase Storage的公共存储桶对象访问路径必须包含public/才能匹配到存储的文件,而当前SDK调用没有在文件路径中加入这个前缀,导致生成的请求URL缺少关键部分,返回404错误。

解决方案

修改update方法中的文件路径,在前面添加public/前缀:

const { data, error } = await supabase
  .storage
  .from('xxx-images')
  .update(`public/xxx_image/${oldPresentationImage}`, presentationImage.file, {
    contentType: 'image/png'
  });
if(error) {console.log('error ', error)};
补充说明

Supabase Storage的对象访问路径格式为storage/v1/object/[访问级别]/[桶名]/[对象路径],其中访问级别分为public、protected、private。如果你的存储桶是公共类型,所有对象的操作路径都需要带上public/前缀,这样SDK才能生成正确的请求URL,匹配到存储桶中的文件。

内容的提问来源于stack exchange,提问作者Richi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 19:07:04