{"record":{"id":"3cf7316db692372e","repo":"Billionmail/BillionMail","slug":"dns-automated-resolution-failed-apikey-or-secretk-3cf731","errorCode":null,"errorMessage":"DNS automated resolution failed: APIKey or SecretKey is empty in CloudXNS configuration file","messagePattern":"DNS automated resolution failed: APIKey or SecretKey is empty in CloudXNS configuration file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/acme/acme.go","lineNumber":214,"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 CloudXNS\n * @param {*lego.Client} client Client\n * @param {map[string]string} keyConfig Configuration information\n * @return error Error information\n */\nfunc SetDnsCloudxns(ctx context.Context, client *lego.Client, keyConfig map[string]string) error {\n\tif keyConfig == nil || keyConfig[\"APIKey\"] == \"\" || keyConfig[\"SecretKey\"] == \"\" {\n\t\treturn errors.New(public.LangCtx(ctx, \"DNS automated resolution failed: APIKey or SecretKey is empty in CloudXNS configuration file\"))\n\t}\n\n\tcfg := cloudxns.NewDefaultConfig()\n\tcfg.APIKey = keyConfig[\"APIKey\"]\n\tcfg.SecretKey = keyConfig[\"SecretKey\"]\n\n\tp, err := cloudxns.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":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/acme/acme.go#L196-L232","documentation":"SetDnsCloudxns configures the lego CloudXNS DNS-01 provider. It validates that keyConfig contains non-empty 'APIKey' and 'SecretKey'; a nil map or either empty value produces this error. CloudXNS' API authenticates each request with an API key plus its secret.","triggerScenarios":"Calling ApplySSLWithExistingServer with dnsProvider 'cloudxns' whose keyConfig is nil or has empty 'APIKey'/'SecretKey' entries (acme.go:213-215).","commonSituations":"CloudXNS credentials never entered for the domain; keys stored under different names ('api_key'); CloudXNS merged into DNSPod/Tencent after service shutdown so users have no valid CloudXNS keys at all; empty strings saved from a blank form.","solutions":["Set both keyConfig[\"APIKey\"] and keyConfig[\"SecretKey\"] to the CloudXNS credentials.","Verify exact map key names 'APIKey' and 'SecretKey'.","If the CloudXNS service is no longer available, switch the DNS provider to DNSPod/Tencent Cloud instead.","Re-save the DNS provider configuration and confirm persistence."],"exampleFix":"// before\nSetDnsCloudxns(ctx, client, nil)\n// after\nSetDnsCloudxns(ctx, client, map[string]string{\"APIKey\": key, \"SecretKey\": secret})","handlingStrategy":"validation","validationCode":"if ak, sk := keyConfig[\"APIKey\"], keyConfig[\"SecretKey\"]; ak == \"\" || sk == \"\" {\n    return errors.New(\"cloudxns DNS config requires non-empty APIKey and SecretKey\")\n}","typeGuard":"func hasCloudXNSKeys(m map[string]string) bool {\n    return m != nil && m[\"APIKey\"] != \"\" && m[\"SecretKey\"] != \"\"\n}","tryCatchPattern":null,"preventionTips":["Validate credentials non-empty before calling the SSL apply flow.","Use exact map keys APIKey and SecretKey.","Check CloudXNS service availability; migrate to DNSPod/Tencent Cloud if deprecated.","Reject blank form submissions when saving the DNS provider config."],"tags":["dns","acme","cloudxns","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"}