I've been encountering an issue where I am unable to fetch a specific JSON data as it times out and fails to receive a response on Vercel deploy. The JSON data I'm trying to fetch is only 18KB in size and the fetch request works perfectly fine in development on localhost. However, once deployed to Vercel, the fetching process stops abruptly. I even attempted using axios, but faced the same problem. Here is the URL of the JSON data I'm attempting to fetch:
Below is a snippet of the code located inside the api routes folder:
/api/checkUpdates.tsx
const url = 'https://www.canada.ca/content/dam/ircc/documents/json/ee_rounds_123_en.json'
export default async (req: NextApiRequest, res: NextApiResponse) => {
console.log('before fetch request')
console.time('fetch')
const data = await fetch(url)
// Everything after this point only executes successfully on localhost
console.timeEnd('fetch')
console.log('fetch success')
const json = await data.json();
console.log('success')
const thisDraw = json.rounds[0]
res.send(thisDraw?.drawNumber)
}
Whenever I attempt to load the page from a Vercel deploy, it seems to hang indefinitely and never loads. The same issue arises when trying to utilize axios. Strangely, everything functions normally on localhost. It appears to be a problem specifically related to that particular page, since I have successfully fetched other JSONs from the internet without any trouble.
Next.JS v13.2.3