Issues with environmental variables

On vercel, I am running the next.js frontend and FastAPI backend. in the settings for the frontend, I have set up environmental variables - I can share the one, as it is not critical and it will illustrate the issue.
The backend is running on https://expenzor-backend.vercel.app

and I have set the environmental variable in the frontend:

when I go to the frontend, I see a number of errors:


It seems like the environmental variable for NEXT_PUBLIC_API_URL is set to https://expenzor-backend-eilxaafp8-niko-gamulins-projects.vercel.app

The following are the lines that cause the errors:

fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/financial-stats/total-expenses`, { headers }),
        fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/financial-stats/monthly-expenses`, { headers }),
        fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/financial-stats/recent-expenses?limit=10`, { headers }),
        fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/analytics/monthly-breakdown/${new Date().getFullYear()}/${new Date().getMonth() + 1}`, { headers }),
        fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/financial-stats/budget-status`, { headers })

So if the environmental variable NEXT_PUBLIC_API_URL is set to https://expenzor-backend.vercel.app, I don’t know where value https://expenzor-backend-eilxaafp8-niko-gamulins-projects.vercel.app/ comes from. It is some old version that is not working and it is not relevant, but don’t know where it comes from.

When I set the environmental variables, I have redeployed the instance.

Hey @nikogamulin. Did you find a solution? I’m not seeing that error in the console now

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.