Strapi fetch data from external url returns InternalServerError from production server only

System Information
  • Strapi Version: v4.6.1
  • Database: MySQL
  • Node Version: v16.19.0

I have created a custom route and controller to make a request to an external API and fetch some data. On my local environment works exactly as expected with both node-fetch and axios, but on my production server both of them return

{
    "data": null,
    "error": {
        "status": 500,
        "name": "InternalServerError",
        "message": "Internal Server Error"
    }
}

In some urls (like some json placeholder data urls) it works. Why does this happen?

You would have to look at the strapi instance that runs production in there you should find an error with more informaiton