http获取图片402需要付款

问题描述 投票:0回答:1

我使用 Facebook 图形 API 来获取我的 Facebook 页面的帖子和带有 vercel 的 nextjs。我收到错误 GET imageurl 402 payment required 即使在本地主机中它工作正常:

也许 vercel 或我的 next.config.js 有问题?

/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "scontent-*.xx.fbcdn.net", // * wildcard on dynamic part of domain url
      },
      {
        protocol: "https",
        hostname: "**",
      },
    ],
    domains: [
      "scontent.fcgm1-1.fna.fbcdn.net",
      "external.fcgm1-1.fna.fbcdn.net",
    ],
  },
  experimental: {
    images: {
      remotePatterns: [
        {
          protocol: "https",
          hostname: "scontent-*.xx.fbcdn.net", // * wildcard on dynamic part of domain url
        },
      ],
    },
  },
  env: {
    ACCESS_TOKEN: process.env.ACCESS_TOKEN,
  }
};

module.exports = nextConfig;
javascript http next.js facebook-graph-api
1个回答
0
投票

您似乎已经超出了 vercel 免费套餐中可用的 1000 个图像优化限制?

如果不需要,您可以禁用该功能。

images: {
    unoptimized: false
}
© www.soinside.com 2019 - 2024. All rights reserved.