0

I am using vite, react, netlify and rapidapi for my project. All requests and functionalities were working perfectly when i was working on localhost and vscode. But when I deployed to the netlify, I ran into error which states e.slice is not a function. While debugging, i found out that in network tab in developer tools, the response from the rapidapi was code 403, and the message that you are not subscribed to the api.

export const exerciseOptions = {
    method: 'GET',
    headers: {
      'X-RapidAPI-Key': import.meta.env.VITE_RAPID_API_KEY,
      'X-RapidAPI-Host': 'exercisedb.p.rapidapi.com'
    }
  };

export const youtubeOptions = {
  method: 'GET',
  headers: {
    'X-RapidAPI-Key': import.meta.env.VITE_RAPID_API_KEY,
    'X-RapidAPI-Host': 'youtube-search-and-download.p.rapidapi.com'
  }
};

export const fetchData = async (url, options) => {  
    const response = await fetch(url, options);
    const data = await response.json();
    return data;
}

I am running this code, works fine on localhost but not working on netlify as i described above.

0 Answers0