Not sure whether you found the answer to your question yet, but in any case, for the client side you would need to add a "NEXT_PUBLIC_" prefix to the variable. So for "API_KEY", you'd have to change it to NEXT_PUBLIC_API_KEY in the .env file, which also means it would be process.env.NEXT_PUBLIC_API_KEY when used. More on this here: nextjs.org/docs/basic-features/env...
Not sure whether you found the answer to your question yet, but in any case, for the client side you would need to add a "NEXT_PUBLIC_" prefix to the variable. So for "API_KEY", you'd have to change it to NEXT_PUBLIC_API_KEY in the .env file, which also means it would be process.env.NEXT_PUBLIC_API_KEY when used. More on this here: nextjs.org/docs/basic-features/env...
This solved my problem. Thanks Elaine
Good to hear!