When deploying to Google Cloud, ensure the following environment variable is set:
NEXT_PUBLIC_DEPLOYMENT_ENV=gcp
This ensures that the application uses the normal runtime environment detection logic instead of forcing PWA mode.
-
Set environment variables in Google Cloud:
gcloud app deploy app.yaml
-
Verify deployment:
- Check that the application is not forcing PWA mode on desktop
- Confirm that mobile detection works correctly
- Test PWA installation on mobile devices
Create app.yaml
in the root directory with:
runtime: nodejs18
env_variables:
NEXT_PUBLIC_DEPLOYMENT_ENV: "gcp"
# Add other environment variables from .env.sample here
Before deploying:
- Test locally with
NEXT_PUBLIC_DEPLOYMENT_ENV=gcp
- Verify that desktop users see the mobile prompt
- Confirm PWA installation works on mobile devices
If PWA mode is incorrectly enabled on desktop:
- Verify
NEXT_PUBLIC_DEPLOYMENT_ENV
is set to "gcp" - Check deployment logs for environment variable issues
- Clear browser cache and reload the page