Here is my app/page.tsx
code.(experimental-edge
is enabled)
export default async function Page() {
// OK
const json = await fetch("https://jsonplaceholder.typicode.com/todos/1").then(
(res) => res.json()
);
// Error
const json = await fetch("https://jsonplaceholder.typicode.com/todos/1", {
method: "GET",
}).then((res) => res.json());
return (
<>
<p>{json.userId}</p>
<p>{json.title}</p>
</>
);
}
How do I process fetch api above without error? Node.js version of my Cloudflare pages settings is 16.14.
I submited issue on github @cloudflare/next-on-pages
, but I could not judge this error is caused by next.js edge-runtime or Cloudflare-pages.
Thanks.