To those facing API/403 errors:
I’m not a pro developer, so please use this as a reference only. If your app works fine in Preview but fails after Publishing (especially in an Nginx + App setup), please check these two possibilities:
- Nginx Container Config: Ensure the nginx-container is configured to access the API key. The proxy needs the key to communicate with the external API.
- Secret Manager Permissions: Check if your service account has the correct permission to access the secret. Even with ‘Editor’ rights, you specifically need the Secret Manager Secret Accessor role to read the value.
Always prioritize security when making these changes. Double-check these two points in your Google Cloud Console!
Sorry if this doesn’t solve your specific case. Good luck with your project!