Next.js process.env.NEXT_PUBLIC variable is undefined in the browser: the fix and the mistake to avoid
In a Next.js client component you log a variable and get this: console.log(process.env.NEXT_PUBLIC_API_URL) // undefined Why it is undefined Next.js only sends variables that start with NEXT_PUBLIC_ to the browser, and…