Why is my NextJS site not getting environmental variables?

Because you need to “forward” your environment variables in your .env file into your next.config.js file.

env file

If you don’t add it to the next.config.js, the value of apiUrl would be “undefined”. So do this:

Have a project in mind?

Websites. Graphics. SEO-oriented content.

I can get your next project off the ground.

See how I have helped my clients.