I'm a full-stack developer and I've got a Next.js application that's been deployed on Azure App Service by my DevOps team using a CI/CD pipeline. Unfortunately, I mistakenly sent them an `.env` file that contains `BASE_URL=http://localhost:3000`. As a result, all requests from the app in production are still pointing to localhost. I attempted to fix this by updating the environment file with the correct production URL and pushing it to the pipeline, but nothing changed. The app continues to send requests to localhost:3000 despite my changes. I've also tried modifying the environment variables through GitHub Actions, but I'm still facing the same issue. I'm not sure if it's an issue with the application code or the production environment itself. Any insights or suggestions would be greatly appreciated!
5 Answers
You might need to do a full rebuild or redeploy along with clearing any cache that's stored in your runners. Sometimes, if the caching layers aren’t cleared, it can lead to stale data showing up.
Take a look at the Azure App Service dashboard. It has built-in environment variable settings that you can configure directly. You should set your `BASE_URL` there instead of relying on the `.env` file. Once updated, redeploy your app and see if that resolves the issue.
How did you even manage to get hired!?
Oh man, that's a classic headache! First off, you really shouldn't send `.env` files to your DevOps team. They should ideally be managing environment variables in the deployment settings themselves. That said, since you’re not seeing any changes after the latest push, it's possible something else could be going on.
Maybe there’s a CDN caching those requests, or your deployment didn’t register the changes. Also, double-check if your browser is caching older versions of the app. My suggestion is to have a chat with your DevOps team to see what their deployment process looks like and stick to that for future changes!
What steps have you already taken to fix this?
I’ve tried pushing the updated `.env` to the codebase, made tweaks through GitHub Actions, and scoured the entire code for any hardcoded localhost entries to ensure there aren’t any. But it looks like something is still overriding the updated URL, reverting it back to localhost:3000.

Bro, I swear I'm not a DevOps expert! Things like these happen.