Let’s pick this apart a bit and get you some next steps so we can help you get it solved!
First off, environment variables set in the UI will only be relevant during builds. So, if you set a variable in the UI, do a local build using something like
next build, and deploy the artifacts using
netlify deploy without building in our CI environment nor via
netlify build (which once your codebase is linked to your site, should pick up variables set in our UI and apply them during build), then they will have no effect. Put another way, if you add a variable after you’ve deployed, it will have no effect, since the variables are only used at build time (while your code is running, and hopefully, the values are being written out to files so we can serve the values, rather than the references). This article has more details on appropriate environment variable usage at Netlify: [Support Guide] Using environment variables on Netlify correctly .
I realize you may know all this, but am being especially verbose for people who don’t who might find this in the future
Due to this feature of our builds, the best debugging method for “are we seeing the variables at all?” will be during build - e.g. if you run “env” in our CI, or if you have that as part of your build command in netlify.toml for
netlify build (e.g.
command = "env && next build"), you should see the right variables and their values - does that happen? If so, we can move on to whether the correct content was built and is being served, but let’s confirm that first.
Once you’ve confirmed that, perhaps you can link us to a page that has an environment variable used on it, and explain how it is interpolated during build, and we can confirm or deny that the value is in the file? Then how it is displayed is more up to you and your codebase, but we’re able to debug that for you without becoming intimately familiar with your codebase, which is not something our staff will be able to do.