{"record":{"id":"15e3302249d73b23","repo":"amir20/dozzle","slug":"api-key-is-required-for-cloud-dispatcher","errorCode":null,"errorMessage":"API key is required for cloud dispatcher","messagePattern":"API key is required for cloud dispatcher","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/notification/dispatcher/cloud.go","lineNumber":39,"sourceCode":"\tName         string\n\tURL          string\n\tAPIKey       string\n\tPrefix       string\n\tExpiresAt    *time.Time\n\tclient       *http.Client\n\tblockedUntil atomic.Int64\n}\n\n// NewCloudDispatcher creates a new cloud dispatcher\nfunc NewCloudDispatcher(name string, apiKey string, prefix string, expiresAt *time.Time) (*CloudDispatcher, error) {\n\turl := os.Getenv(\"DOLIGENCE_URL\")\n\tif url == \"\" {\n\t\turl = \"https://doligence.dozzle.dev\"\n\t}\n\turl = url + \"/api/events\"\n\n\tif apiKey == \"\" {\n\t\treturn nil, fmt.Errorf(\"API key is required for cloud dispatcher\")\n\t}\n\n\treturn &CloudDispatcher{\n\t\tName:      name,\n\t\tURL:       url,\n\t\tAPIKey:    apiKey,\n\t\tPrefix:    prefix,\n\t\tExpiresAt: expiresAt,\n\t\tclient: &http.Client{\n\t\t\tTimeout: 10 * time.Second,\n\t\t},\n\t}, nil\n}\n\nconst defaultRetryAfter = 60 * time.Second\n\n// unauthorizedRetryAfter is how long to back off after an auth failure (invalid/expired\n// API key). Retrying won't help until the user fixes their key, which recreates the","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/notification/dispatcher/cloud.go#L21-L57","documentation":"NewCloudDispatcher is a constructor guard: the Dozzle Cloud dispatcher requires an API key credential, and an empty key was supplied. Without it the dispatcher cannot authenticate to the cloud events endpoint, so construction fails rather than creating a dispatcher that would fail on every send.","triggerScenarios":"Thrown at internal/notification/dispatcher/cloud.go:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the API key from the cloud configuration (cloud.yml / UpdateCloudConfig).","If cloud notifications are not wanted, do not create a cloud dispatcher at all instead of passing an empty key.","Re-authenticate with Dozzle Cloud to obtain a fresh, non-empty API key."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}