I have subscribed to an API from RapidAPI. It worked fine locally, but after deploying the next application on to Vercel it's not working.
The code for API call:
export const compileCode= async ( payload )=>{
const options = {
method: 'POST',
url: 'https://judge0-ce.p.rapidapi.com/submissions',
params: {
base64_encoded: 'true',
fields: '*'
},
headers: {
'content-type': 'application/json',
'Content-Type': 'application/json',
'X-RapidAPI-Key': process.env.JUDGE0_API,
'X-RapidAPI-Host': 'judge0-ce.p.rapidapi.com'
},
data: payload
};
try{
const {data}= await axios.request(options)
return data
} catch(error){
console.log(error)
alert("Something went wrong => "+ error)
}}
This is the error message:
Failed to load resource: the server responded with a status of 401 ()