Custom build with cloudflare dns is breaking

1. The problem I’m having:

I am trying to build caddy with the cloudflare DNS plugin. The build is failing.

2. Error messages and/or full log output:

/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:386:9: invalid composite literal type libdns.Record
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:445:17: zrec.record.Type undefined (type libdns.Record has no field or method Type)
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:449:45: zrec.record.Name undefined (type libdns.Record has no field or method Name)
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:462:42: zrec.record.Type undefined (type libdns.Record has no field or method Type)
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:463:45: zrec.record.Value undefined (type libdns.Record has no field or method Value)
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:467:74: zrec.record.Value undefined (type libdns.Record has no field or method Value)
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:469:116: zrec.record.Name undefined (type libdns.Record has no field or method Name)
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:507:39: zrec.record.ID undefined (type libdns.Record has no field or method ID)
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:508:41: zrec.record.Name undefined (type libdns.Record has no field or method Name)
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:509:41: zrec.record.Type undefined (type libdns.Record has no field or method Type)
/home/proxybox/go/pkg/mod/github.com/caddyserver/certmagic@v0.21.6/solvers.go:509:41: too many errors

3. Caddy version:

This is not a Caddy issue, it is a Caddy build issue.
xcaddy v0.4.4
go 1.24.0

4. How I installed and ran Caddy:

a. System environment:

Debian linux, zsh, nothing else seems relevant.

b. Command:

go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
xcaddy build --with github.com/caddy-dns/cloudflare

Note, I tried going to the previously used versions of libdns/libdns and libdns/cloudflare - but the build auto-upgraded them and still failed:

xcaddy build \
  --with github.com/caddy-dns/cloudflare \
  --with github.com/libdns/cloudflare@v0.1.3 \
  --with github.com/libdns/libdns@v0.2.3

Either use an older version of the cloduflare plugin (eg: --with github.com/caddy-dns/cloudflare@188b4850c0f2f5565a6310810c936ea960e2210f) or upgrade the certmagic and caddy components:

--with github.com/caddyserver/certmagic@master
--with github.com/caddyserver/caddy@master

or

--with github.com/caddyserver/certmagic@b9399eadfbe7ac3092f4e65d45284b3aabe514f8
--with github.com/caddyserver/caddy@9becf61a9f5bafb88a15823ce80c1325d3a30a4f
4 Likes