Deploying in Vercel got error: connect ECONNREFUSED 54.178.252.149:80

Deploying in Vercel got error: connect ECONNREFUSED 54.178.252.149:80

我的环境在这里:

Environment Version
Rails 7.0.0
Axios 0.26.1
React 18.0
Next.js 12.1.5
AWS EC2 Production
Nginx Production

我正在尝试在最合适的时间在 Vercel 中进行部署。
目前我的下一个应用程序在本地运行良好。

当我在 vercel 中部署时出现错误:

info  - Collecting page data...
> Build error occurred
Error: connect ECONNREFUSED 54.178.252.149:80
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
  type: 'Error',
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    transformRequest: [ null ],
    transformResponse: [ null ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    headers: {
      Accept: 'application/json, text/plain, */*',
      'User-Agent': 'axios/0.26.1'
    },
    method: 'get',
    url: 'https://mydomain/admin/users_data'
  },
  code: 'ECONNREFUSED',
  status: null
}
Error: Command "next build" exited with 1

我正在使用 SSGISR
设置在这里:

export const getStaticPaths = async () => {
  const data = await axios.get(
    `${process.env.NEXT_PUBLIC_ENDPOINT}/admin/users_data`
  );

  const paths = data.data.users.map((user: any) => {
    return { params: { id: user.id.toString() } };
  });
  return {
    paths,
    fallback: true,
  };
};

export const getStaticProps = async (params: any) => {
  const data = await axios.get(
    `${process.env.NEXT_PUBLIC_ENDPOINT}/admin/detail/${params.params.id}`
  );
  const user_id = data.data.user_id;
  return {
    props: { user_id },
    revalidate: 1800,
  };
};

我认为错误的所有原因都是 cors
所以我重写了来自 rails:

cors.rb
Rails.application.config.middleware.insert_before 0, Rack::Cors do
  allow do
    origins 'http://localhost:3001', #client side is port 3001
            'https://staging-hoge-rails.vercel.app', # <-- here!

    resource '*',
             headers: :any,
             expose: %w[access-token expiry token-type uid client],
             methods: %i[get post put patch delete options head],
             credentials: true
  end
end

但是还是出现那个错误...

我不确定 vercel 的来源是否正确。
我在 Vercel 仪表板中引用了此页面。

有什么需要部署的?
任何建议都会对我有所帮助。

谢谢。

是cors问题。
我删除了:

export const getStaticPaths = async () => {
  const data = await axios.get(
    `${process.env.NEXT_PUBLIC_ENDPOINT}/admin/users_data`
  );

  const paths = data.data.users.map((user: any) => {
    return { params: { id: user.id.toString() } };
  });
  return {
    paths,
    fallback: true,
  };
};

export const getStaticProps = async (params: any) => {
  const data = await axios.get(
    `${process.env.NEXT_PUBLIC_ENDPOINT}/admin/detail/${params.params.id}`
  );
  const user_id = data.data.user_id;
  return {
    props: { user_id },
    revalidate: 1800,
  };
};

现在。

然后构建是。
但这不是根本的解决办法。