{"record":{"id":"4aac7dccbebbd148","repo":"SigNoz/signoz","slug":"errcodeinvalidinput-4aac7d","errorCode":"ErrCodeInvalidInput","errorMessage":"invalid deployment: missing name or DNS","messagePattern":"invalid deployment: missing name or DNS","errorType":"validation","errorClass":"errors SigNozError","httpStatus":400,"severity":"error","filePath":"pkg/types/cloudintegrationtypes/account.go","lineNumber":320,"sourceCode":"\t\t\t\tProjectIDs:          config.Config.GCP.ProjectIDs,\n\t\t\t\tDeploymentRegion:    config.Config.GCP.DeploymentRegion,\n\t\t\t},\n\t\t}, nil\n\tdefault:\n\t\treturn nil, errors.NewInvalidInputf(ErrCodeCloudProviderInvalidInput, \"invalid cloud provider: %s\", provider.StringValue())\n\t}\n}\n\nfunc NewAgentReport(data map[string]any) *AgentReport {\n\treturn &AgentReport{\n\t\tTimestampMillis: time.Now().UnixMilli(),\n\t\tData:            data,\n\t}\n}\n\nfunc GetSigNozAPIURLFromDeployment(deployment *zeustypes.GettableDeployment) (string, error) {\n\tif deployment.Name == \"\" || deployment.Cluster.Region.DNS == \"\" {\n\t\treturn \"\", errors.New(errors.TypeInvalidInput, ErrCodeInvalidInput, \"invalid deployment: missing name or DNS\")\n\t}\n\n\treturn fmt.Sprintf(\"https://%s.%s\", deployment.Name, deployment.Cluster.Region.DNS), nil\n}\n\nfunc (account *Account) Update(provider CloudProviderType, config *AccountConfig) error {\n\t// deployment region can not be updated once set for Azure\n\tif provider == CloudProviderTypeAzure {\n\t\tconfig.Azure.DeploymentRegion = account.Config.Azure.DeploymentRegion\n\t}\n\n\taccount.Config = config\n\taccount.UpdatedAt = time.Now()\n\n\treturn nil\n}\n\nfunc (postableAccount *PostableAccount) UnmarshalJSON(data []byte) error {","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/types/cloudintegrationtypes/account.go#L302-L338","documentation":"GetSigNozAPIURLFromDeployment builds the SigNoz API URL as https://{name}.{DNS} from a deployment record; it requires both deployment.Name and deployment.Cluster.Region.DNS to be non-empty. Empty values mean the deployment record is incomplete and the URL cannot be constructed.","triggerScenarios":"GetConnectionCredentials invoked with a deployment whose Name is empty or whose Cluster.Region.DNS is unset — e.g. a deployment fetched by ID that doesn't exist (zero-value struct) or created without a region.","commonSituations":"Passing a nil-ish or freshly-allocated GettableDeployment instead of the fetched one; deployments provisioned before region DNS was a required field; lookups returning empty structs instead of not-found errors.","solutions":["Verify the deployment actually exists before calling — check the fetch returned a populated record","Ensure the deployment has a Name and its cluster region has a DNS name set","Fix the upstream fetch to return a proper not-found error instead of an empty struct","Persist/re-derive missing region DNS in your deployment data"],"exampleFix":"// before\ndep := &zeustypes.GettableDeployment{} // zero value\nurl, err := cloudintegrationtypes.GetSigNozAPIURLFromDeployment(dep)\n// after\ndep, err := fetchDeployment(ctx, id)\nif err != nil || dep == nil { return err }\nurl, err := cloudintegrationtypes.GetSigNozAPIURLFromDeployment(dep)\n","handlingStrategy":"try-catch","validationCode":"if deployment == nil || deployment.Name == \"\" || deployment.Cluster.Region.DNS == \"\" { abort with clear error }","typeGuard":null,"tryCatchPattern":"url, err := cloudintegrationtypes.GetSigNozAPIURLFromDeployment(dep)\nif err != nil { logDeploymentFields(dep); return fmt.Errorf(\"deployment incomplete: %w\", err) }","preventionTips":["Treat empty fetch results as not-found","Require name+region DNS at deployment creation"],"tags":["cloud-integration","signoz","deployment","validation","go"],"backgroundTag":"missing-required-attribute","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}