Nextjs Api: TypeError: Cannot read properties of undefined (reading 'headers')

My website:

I deployed a nextjs app that contains api’s and also uses environment variables. I have added the environment variables to their section in the netlify console and the app also deploys without any issues. But I keep getting this error when i try to call my single api.

The app works perfectly locally but when running it in dev and using netlify cli, but it does not work once its deployed to netlify.

The full api route is https://main–

Hey there, @WeedleApp :wave:

Thanks so much for reaching out. Can you share your repository and also your full deploy log so that we can look into this further? This will help us have more context when debugging.