gm guys
In my NextJS app, I have a server I call through an API from the front end
This API itself calls a lot of APIs, and I noticed recently that some of the API does not work if I don't add this specific header (thks chatgpt)
This is how I used to call my
const response = await axios.get(chain.api_url, {
params: {
module: "account",
action: type,
address,
offset: sizeOffset, //Number of transaction (increase to 100 later)
sort: "desc",
apikey: chain.api_key,
},
});
And now:
const response = await axios.get(chain.api_url, {
params: {
module: "account",
action: type,
address,
offset: sizeOffset, //Number of transaction (increase to 100 later)
sort: "desc",
apikey: chain.api_key,
},
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
},
});
With the header, it works.
I mean... it works on localhost, but once I deploy the app on Vercel, it doesn't work
It is much harder to debug since I don't have the console to read the logs once hosted, how can I solve this?