My next.js js server on Firebase apphosting is not able to bundle GEMINI_API_KEY and make available

I have tried everything since 5 days. I am exasperated. I have added the gemini_api_key in .env files, added as secret manager, added in apphosting.yaml, added as a variable in the production environment but am not able to find the key in server run ai commands. please help!!