错误:编码的 URI 在使用 firebase 部署的 nextjs 应用程序上返回错误

问题描述

我在 firebase 上部署了一个 nextjs 应用程序。每个具有用 %20 编码的空格的产品都会返回错误:发生意外错误。 它在本地主机上运行良好,但在我部署时不再运行。 你知道为什么吗?

api.js

export async function fetchAPI(path) {
  const requestUrl = getStrapiURL(path);
  const response = await fetch(requestUrl);
  const data = await response.json();
  return data;
}

export async function getProduct(name) {
  const products = await fetchAPI(`/books?name=${name}`);
  return products?.[0];
}

[name.js]

const paths = products.map(
    (product) => `/books/${encodeURIComponent(product.name)}`
  );
  return { paths,fallback: false };
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)