Skip to content

Fix GCP Cloud Run Run Custom Domain Errors

DodaTech Updated 2026-06-26 2 min read

When working with GCP Cloud Run, you may encounter a configuration error that prevents your deployment from working. This guide explains the most common mistake with run custom domain and shows the exact fix.

A Common Mistake

Mapping a custom domain to Cloud Run without verifying domain ownership, causing the mapping to fail with a domain verification error.

The incorrect command:

gcloud beta run domain-mappings create --service=my-service --domain=app.example.com --region=us-central1

Error output:

ERROR: (gcloud.beta.run.domain-mappings.create) FAILED_PRECONDITION: The domain app.example.com has not been verified. Verify ownership by adding a TXT record to your DNS configuration:
Name: _gcloud-app.example.com
Value: google-site-verification=XXXXXX
TTL: 300

The Correct Approach

The right way to configure run custom domain in GCP Cloud Run:

gcloud domains verify app.example.com && gcloud beta run domain-mappings create --service=my-service --domain=app.example.com --region=us-central1

Successful result:

Creating mapping...
Domain mapping created.
Add these DNS records:
Type: CNAME
Name: app.example.com
Value: ghs.googlehosted.com
Then wait 5-10 minutes for DNS propagation.
The service is available at https://app.example.com

How to Prevent This

Verify domains with gcloud domains verify. Use Cloud DNS for managed DNS. CNAME records must point to ghs.googlehosted.com. Domain mappings are per-region. Use a global load balancer for multi-region custom domains. Wildcard domains (*.example.com) require a special mapping.

FAQ

Why does my run custom domain configuration fail in GCP Cloud Run?

Configuration failures in GCP Cloud Run usually stem from missing IAM permissions, incorrect parameter syntax, unfulfilled prerequisites, or incorrect API versions. Always run commands with --help first to verify parameter names and formats. Check Cloud Audit Logs for detailed error traces. The error message typically contains a link to the relevant documentation section.

How do I debug run custom domain issues in GCP Cloud Run?

Start by enabling Cloud Logging for your service. Use gcloud logging read to query error logs. For IAM issues, use the Policy Analyzer tool. For networking issues, use VPC flow logs. For function/run issues, check the container logs with gcloud logging tail. Always validate your configuration with dry-run flags before applying to production.

What are the best practices for run custom domain in GCP Cloud Run?

Use infrastructure-as-code for all configurations. Test changes in a non-production project first. Set up billing alerts. Enable Cloud Audit Logs. Follow least privilege for IAM. Review and update configurations regularly. Document manual changes for compliance audits. Monitor with dashboards and alerts.


Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Secure your cloud with DodaTech.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro