Can't receive response from graphhopper

I am trying to send start point and end point to receive the route between these 2 points. this is the code that I have for receiving the route:

const calculateRoute = async () => {
if (originPosition && destinationPosition) {
  const origin = `${},${originPosition.lng}`;
  const destination = `${},${destinationPosition.lng}`;
  console.log("Origin:", origin); // Log origin coordinates
  console.log("Destination:", destination); // Log destination coordinates
  try {
    const response = await axios.get(
    console.log("API response:",;
    if ( && && > 0
    ) {
      const route =[0];
      if (route.points && route.points.coordinates) {
        const coordinates = => [
      } else {
        console.error("No coordinates found in route");
    } else {
      console.error("No routes found");
  } catch (error) {
    console.error("Error fetching directions:", error.message);

I know that the origin and destination are not null values and that the error comes from an empty response. What am I missing and what can I do to debbug it further???

This works:,10.6&point=51.2,10.7&vehicle=foot&locale=en&calc_points=true&key=3298a94b-9a17-49ee-a2c4-d756d163c7b8

So the error must be in your client code somewhere? Do you see any console output when you run this code in your (web)app? Did you check the network tab to see the result of the request?