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

生产环境中Next Image加载Contentful资源出现502错误求助

Next.js 13.4.3生产环境加载Contentful图片报502错误(已配置remotePatterns,本地正常)

生产环境使用Next.js Image组件加载Contentful图片时出现502错误,已在next.config.js中配置remotePatterns规则,但问题仍未解决。本地环境下所有功能均正常运行,使用的Next.js版本为13.4.3。

相关配置代码

const config = {
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'images.ctfassets.net',
        port: '',
        pathname: '/**',
      },
    ],
  },
}

组件中Image使用代码片段

case contentful.types.jumbotron: {
  const transformedJumbotronData = transformJumbotron(section.data);
  console.log('https:' + transformedJumbotronData.image.url);
  //输出内容为https://images.ctfassets.net/ABC123/Full_image.png
  const desktopImage = (
    <Image
      src={'https:' + transformedJumbotronData.image.url}
      width={500}
      height={500}
      alt={transformedJumbotronData.image.alt}
    />
  );
  sectionComponents.push(
    <Jumbotron
      key={index}
      ctaButtons={transformedJumbotronData.ctaButtons}
      desktopImage={desktopImage} //接受JSX元素
      title={transformedJumbotronData.title}
    />
  );

错误截图

生产环境502错误截图

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.10 22:05:27