I ran into a similar error. I found this on stackoverflow.
This is the modification to the getStrapiURL function in api.js.
export function getStrapiURL(path = "") {
return `${
process.env.NEXT_PUBLIC_STRAPI_API_URL || "http://127.0.0.1:1337"
}${path}`;
}
Cheers!