Error 400: Invalid value for field 'resource.name'
when deploying https://github.com/GabrielLunesu/AdNavi i run into this issue, i am not sure what it is but it keeps retrying, these are the logs:
2025-11-25T18:57:26.114+01:00 backend 00147782 INFO: 169.254.169.126:14725 - "GET /health HTTP/1.1" 200 OK 2025-11-25T18:57:27.321+01:00 cd-gcp 62449962 ** Building image for "scheduler"... 2025-11-25T18:57:27.721+01:00 cd-gcp 62449962 ** Building image for "worker"... 2025-11-25T18:57:36.117+01:00 backend 00147782 INFO: 169.254.169.126:14241 - "GET /health HTTP/1.1" 200 OK 2025-11-25T18:57:40.330+01:00 cd-gcp 62449962 error: gcp:compute/firewall:Firewall resource 'defang-adnavi-t8zgrthold5r2-prod1-qa_worker-mig-h2p9d2s' has a problem: "name" ("defang-adnavi-t8zgrthold5r2-prod1-qa_worker-mig-h2p9d2s-7e98045") doesn't match regexp "^(?:a-z?)$". Examine values at 'defang-adnavi-t8zgrthold5r2-prod1-qa_worker-mig-h2p9d2s.name'. 2025-11-25T18:57:41.283+01:00 cd-gcp 62449962 error: sdk-v2/provider2.go:572: sdk.helper_schema: Error creating HealthCheck: googleapi: Error 400: Invalid value for field 'resource.name': 'defang-adnavi-t8zgrthold5r2-prod1-qa_worker-8080-xr0kvh-be83b41'. Must be a match of regex '(?:a-z?)' Details: [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "domain": "compute.googleapis.com", "metadata": { "field": "resource.name", "reason": "Must be a match of regex '(?:a-z?)'", "value": "defang-adnavi-t8zgrthold5r2-prod1-qa_worker-8080-xr0kvh-be83b41" }, "reason": "INVALID_FIELD_VALUE" }, { "@type": "type.googleapis.com/google.rpc.LocalizedMessage", "locale": "en-US", "message": "Invalid value for field 'resource.name': 'defang-adnavi-t8zgrthold5r2-prod1-qa_worker-8080-xr0kvh-be83b41'. Must be a match of regex '(?:a-z?)'" } ] , invalid: [email protected] 2025-11-25T18:57:41.283+01:00 cd-gcp 62449962 error: 1 error occurred: * Error creating HealthCheck: googleapi: Error 400: Invalid value for field 'resource.name': 'defang-adnavi-t8zgrthold5r2-prod1-qa_worker-8080-xr0kvh-be83b41'. Must be a match of regex '(?:a-z?)' Details: [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "domain": "compute.googleapis.com", "metadata": { "field": "resource.name", "reason": "Must be a match of regex '(?:a-z?)'", "value": "defang-adnavi-t8zgrthold5r2-prod1-qa_worker-8080-xr0kvh-be83b41" }, "reason": "INVALID_FIELD_VALUE" }, { "@type": "type.googleapis.com/google.rpc.LocalizedMessage", "locale": "en-US", "message": "Invalid value for field 'resource.name': 'defang-adnavi-t8zgrthold5r2-prod1-qa_worker-8080-xr0kvh-be83b41'. Must be a match of regex '(?:a-z?)'" } ] , invalid 2025-11-25T18:57:43.121+01:00 cd-gcp 62449962 Update failed in 8m38.587812298s 2025-11-25T18:57:43.441+01:00 cd-gcp 62449962 Executing forced refresh... 2025-11-25T18:57:46.119+01:00 backend 00147782 INFO: 169.254.169.126:5107 - "GET /health HTTP/1.1" 200 OK 2025-11-25T18:57:50.049+01:00 cd-gcp 62449962 Refresh completed at 8m45.516732826s 2025-11-25T18:57:56.121+01:00 backend 00147782 INFO: 169.254.169.126:38665 - "GET /health HTTP/1.1" 200 OK
The error is clear: GCP resource names don't allow underscores (_). The problematic names contain underscores like qa_worker which violates GCP's naming regex ^(?:a-z?)$.
Repro:
name: my_proj
services:
my_app:
image: nginx:latest
ports: [80]
To be fair, the best course of action here is to rename the services in your Compose file. Different clouds have different rules and for us to silently rename your service(s) to match the rules of the cloud is hard, and potentially confusing since you won't easily find the service in the Cloud dashboard if the names don't match.
_ is common enough so we should probably handle that? We already handle ..