Billionmail/BillionMail · error

DNS provider initialization failed: {}

Error message

DNS provider initialization failed: {}

What it means

After loading SecretId/SecretKey into a tencentcloud.NewDefaultConfig, SetDnsTencentcloud calls tencentcloud.NewDNSProviderConfig(cfg) to build the lego DNS provider. If lego's Tencent Cloud provider rejects the config (bad credential format, unsupported options), the constructor returns an error which is wrapped in this message.

Source

Thrown at core/internal/service/acme/acme.go:140

/**
 * @description: Configure DNS verification via Tencent Cloud
 * @param {*lego.Client} client Client
 * @param {map[string]string} keyConfig Configuration information
 * @return error Error information
 */
func SetDnsTencentcloud(ctx context.Context, client *lego.Client, keyConfig map[string]string) error {
	if keyConfig == nil || keyConfig["SecretId"] == "" || keyConfig["SecretKey"] == "" {
		return errors.New(public.LangCtx(ctx, "DNS automated resolution failed: SecretId or SecretKey is empty in TencentCloud configuration file"))
	}

	cfg := tencentcloud.NewDefaultConfig()
	cfg.SecretID = keyConfig["SecretId"]
	cfg.SecretKey = keyConfig["SecretKey"]

	p, err := tencentcloud.NewDNSProviderConfig(cfg)
	if err != nil {
		return errors.New(public.LangCtx(ctx, "DNS provider initialization failed: {}", err.Error()))
	}

	err = client.Challenge.SetDNS01Provider(p)
	if err != nil {
		return errors.New(public.LangCtx(ctx, "DNS verification setup failed: {}", err.Error()))
	}
	return nil
}

/**
 * @description: Configure DNS verification via Alibaba Cloud
 * @param {*lego.Client} client Client
 * @param {map[string]string} keyConfig Configuration information
 * @return error Error information
 */
func SetDnsAliyun(ctx context.Context, client *lego.Client, keyConfig map[string]string) error {
	if keyConfig == nil || keyConfig["APIKey"] == "" || keyConfig["SecretKey"] == "" {
		return errors.New(public.LangCtx(ctx, "DNS automated resolution failed: APIKey or SecretKey is empty in AliDNS configuration file"))

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Inspect the wrapped err text in the message to see the underlying provider failure.
  2. Re-enter Tencent Cloud SecretId/SecretKey, trimming whitespace and confirming the full key.
  3. Test the credentials against the Tencent Cloud DNS API (e.g. via the console or SDK) to confirm validity.
  4. Update the lego dependency to a version compatible with the current provider config.

Example fix

// before
cfg.SecretID = strings.TrimSpace(" AKID... ") // kept stray spaces
// after
cfg.SecretID = strings.TrimSpace(keyConfig["SecretId"])
cfg.SecretKey = strings.TrimSpace(keyConfig["SecretKey"])
Defensive patterns

Strategy: try-catch

Validate before calling

if m != nil && m["SecretId"] != "" && m["SecretKey"] != "" {
    // safe to attempt provider construction
}

Type guard

func hasTencentKeys(m map[string]string) bool {
    return m != nil && m["SecretId"] != "" && m["SecretKey"] != ""
}

Try / catch

p, err := tencentcloud.NewDNSProviderConfig(cfg)
if err != nil {
    log.Printf("tencentcloud DNS provider init failed: %v", err)
    return fmt.Errorf("invalid TencentCloud credentials: %w", err)
}

Prevention

When it happens

Trigger: tencentcloud.NewDNSProviderConfig(cfg) returns non-nil err in SetDnsTencentcloud (acme.go:139-142), typically when the provided credentials are malformed or the SDK cannot initialize the provider.

Common situations: SecretId/SecretKey contain whitespace or invalid characters; copy-paste truncated the key; lego version where the tencentcloud provider changed its config requirements; placeholder credentials ('xxx') saved in the panel.

Related errors


AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05). Data as JSON: /api/errors/0d078c5903b7d3a0. Report an issue: GitHub.