{"record":{"id":"e819e78089cdbbd8","repo":"Billionmail/BillionMail","slug":"dns-automated-resolution-failed-apikey-or-email-i","errorCode":null,"errorMessage":"DNS automated resolution failed: APIKey or Email is empty in Cloudflare configuration file","messagePattern":"DNS automated resolution failed: APIKey or Email is empty in Cloudflare configuration file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/acme/acme.go","lineNumber":186,"sourceCode":"\t}\n\n\terr = client.Challenge.SetDNS01Provider(p)\n\tif err != nil {\n\t\treturn errors.New(public.LangCtx(ctx, \"DNS verification setup failed: {}\", err.Error()))\n\t}\n\n\treturn nil\n}\n\n/**\n * @description: Configure DNS verification via Cloudflare\n * @param {*lego.Client} client Client\n * @param {map[string]string} keyConfig Configuration information\n * @return error Error information\n */\nfunc SetDnsCloudflare(ctx context.Context, client *lego.Client, keyConfig map[string]string) error {\n\tif keyConfig == nil || keyConfig[\"APIKey\"] == \"\" || keyConfig[\"Email\"] == \"\" {\n\t\treturn errors.New(public.LangCtx(ctx, \"DNS automated resolution failed: APIKey or Email is empty in Cloudflare configuration file\"))\n\t}\n\n\tcfg := cloudflare.NewDefaultConfig()\n\tcfg.AuthEmail = keyConfig[\"Email\"]\n\tcfg.AuthKey = keyConfig[\"APIKey\"]\n\n\tp, err := cloudflare.NewDNSProviderConfig(cfg)\n\tif err != nil {\n\t\treturn errors.New(public.LangCtx(ctx, \"DNS provider initialization failed: {}\", err.Error()))\n\t}\n\n\terr = client.Challenge.SetDNS01Provider(p)\n\tif err != nil {\n\t\treturn errors.New(public.LangCtx(ctx, \"DNS verification setup failed: {}\", err.Error()))\n\t}\n\n\treturn nil\n}","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/acme/acme.go#L168-L204","documentation":"SetDnsCloudflare configures the lego Cloudflare DNS-01 provider using the legacy global API key auth scheme (AuthEmail + AuthKey). It validates that keyConfig has non-empty 'APIKey' and 'Email'; otherwise it returns this error. Cloudflare's global API key authentication requires both the key and the account email.","triggerScenarios":"Calling ApplySSLWithExistingServer with dnsProvider 'cloudflare' whose keyConfig is nil or has empty 'APIKey'/'Email' entries (acme.go:185-187).","commonSituations":"User supplied a Cloudflare API Token instead of the global API key (token flow needs AuthToken, not Email+AuthKey); email field left blank in the panel; keys renamed in the config map ('authEmail'); global API key disabled/rotated in the Cloudflare dashboard.","solutions":["Provide both keyConfig[\"APIKey\"] (Cloudflare Global API Key) and keyConfig[\"Email\"] (account email).","If using an API Token instead, switch to the token-based config fields rather than Email+APIKey.","Verify the map keys are exactly 'APIKey' and 'Email'.","Re-generate/copy the Global API Key from Cloudflare dashboard (My Profile -> API Tokens)."],"exampleFix":"// before\nkeyConfig := map[string]string{\"APIKey\": cfKey} // email missing\n// after\nkeyConfig := map[string]string{\"APIKey\": cfKey, \"Email\": \"user@example.com\"}","handlingStrategy":"validation","validationCode":"if ak, em := keyConfig[\"APIKey\"], keyConfig[\"Email\"]; ak == \"\" || em == \"\" {\n    return errors.New(\"cloudflare DNS config requires non-empty APIKey (Global API Key) and Email\")\n}","typeGuard":"func hasCloudflareGlobalKey(m map[string]string) bool {\n    return m != nil && m[\"APIKey\"] != \"\" && m[\"Email\"] != \"\"\n}","tryCatchPattern":null,"preventionTips":["Clarify in the UI that Global API Key + Email is required, not an API Token.","Validate both fields non-empty before saving the provider config.","Use exact map keys APIKey and Email.","Re-copy the Global API Key after any rotation in Cloudflare."],"tags":["dns","acme","cloudflare","missing-credentials","config"],"backgroundTag":"missing-api-credentials","analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}