I keep getting an error saying I’m not subscribed to the API even though I have my RapidAPI key set up correctly. I’m trying to fetch video data but it’s not working.
Check if you’re actually subscribed to the YouTube v3 API on RapidAPI first. People often think they’re subscribed when they’ve just created an account. Log into your RapidAPI dashboard and verify your subscription status for youtube-v31.p.rapidapi.com. I’ve seen this exact error when subscriptions expire or when free tier requests run out. Some endpoints need different subscription plans too - the search endpoint might require paid access even if you have free access elsewhere. Your auth header looks fine assuming the env variable loads correctly.
you’re mixing frontend and backend code. if this runs in the browser, your rapidapi key gets exposed to users - that’s a security risk. move the api calls to your backend or set up a proxy. also check if your subscription expired. rapidapi sometimes kills free trials without much warning.
Had the same issue last month - it’s an environment variable problem. You’re using process.env.REACT_APP_API_KEY in what looks like a Node.js backend, and that’s the issue. The REACT_APP_ prefix only works with Create React App frontends, not Node.js. Change your env variable to just API_KEY or RAPIDAPI_KEY and update your code to process.env.API_KEY. Also check that your .env file is in the right directory where your Node.js process runs. Add console.log(process.env.REACT_APP_API_KEY) to see if it’s undefined - that’d explain the subscription error since RapidAPI can’t authenticate without a valid key.