I have an environment variable set to access my external API (eg https://myBaseUrl.com)
It works properly in the development environment, but in production, requests are made to URLs modified like so: https://otherlane.netlify.app/myBaseUrl.com
I’ve triple checked and this is not what I have set in my environment variable set through the browser. Is there another setting I am missing?
Without any details like the site’s name, we cannot check anything.
Is is not the correct site name?
https://otherlane.netlify.app
It is also listed as just “otherlane”
This is how my import is structured:
const baseUrl =
${import.meta.env.VITE_API_URL}`;
and this is an example of a usage that is being misconstructed:
let url = ${baseUrl}/map/?...
you can see this behavior in console immediately when you open the site.
It appears you’ve updated the environment variables after you’ve deployed. I’m assuming the previous deploy did not have the HTTPS prefix. You should try deploying again.
On a side note, there’s no point in using environment variables to mask the URL. The URL is easily visible in dev tools. So you should probably hardcode it directly.
Ok, thank you! The URL used in development is different than the one used in production, which is why I set it up that way.
So looks like that has been resolved now?
Yes, it is working now, thank you!