TypeError Only Absolute Urls are supported [NEXTjs]

I am working on a next js project a client provided me. But when I start the project I get this error saying Only absolute urls are supported. oh I don’t have the dot env file. is this error causing for the env file? I have tried using hardcodeing loaclhost:XXXX but that throws another error saying Bad protocol expected htps instead got http here is the code.


import https from “https”;

import { getIp } from “./ip”;

const agent = new https.Agent({
rejectUnauthorized: false,
requestCert: false,
});

function createHttpClient(base) {
return async function client(
endpoint,
{ data, params, headers: customHeaders, request = {}, …customConfig } = {}
) {
const config = {
agent,
body: data ? JSON.stringify(data) : undefined,
method: data ? “post” : “get”,
headers: {
Accept: “application/json”,
“Content-Type”: “application/json”,
“X-Real-IP”: getIp(request),
// TODO: Authorization: Bearer ${token},
…customHeaders,
},
…customConfig,
};

let url = [base, endpoint].join("/");
if (params) url = [url, new URLSearchParams(params)].join("?");

return fetch(url, config).then(async response => {
  const data = await response.json();
  if (response.ok) {
    return data;
  } else {
    return Promise.reject(data);
  }
});

};
}

const browserClient = createHttpClient(process.env.NEXT_PUBLIC_API_URL);
const serverClient = createHttpClient(process.env.API_URL);

export { browserClient, serverClient };


I have tried hardcoding localhost that did not worked