caddy-dns / porkbun

MIT License
27 stars 8 forks source link

Getting build errors with xcaddy #10

Closed Monviech closed 3 months ago

Monviech commented 6 months ago

Hello :)

My current caddy build:

https://github.com/Monviech/os-caddy-plugin/blob/main/usr/local/bin/README.md#current-build

Error I'm getting:

# github.com/libdns/porkbun
/root/go/pkg/mod/github.com/libdns/porkbun@v0.1.2/models.go:51:13: cannot use priority (variable of type int) as uint value in struct literal
func (record pkbnRecord) toLibdnsRecord(zone string) libdns.Record {
        ttl, _ := time.ParseDuration(record.TTL + "s")
        priority, _ := strconv.Atoi(record.Prio)
        return libdns.Record{
                ID:       record.ID,
                Name:     libdns.RelativeName(record.Name, LibdnsZoneToPorkbunDomain(zone)),
                Priority: priority,
                TTL:      ttl,
                Type:     record.Type,
                Value:    record.Content,
        }
}

How I solve this build error:

in func (record pkbnRecord) I change priority to uint(priority)

Then the build works for me.

Monviech commented 6 months ago

It's an incompability in the build between this and another DNS Provider --with github.com/caddy-dns/vultr

I'm closing this here, thank you.

zond0541 commented 3 months ago

I am running into this same error now.

Two days ago, I was able to build the program successfully, but have since switched computers, and running (as far as I can tell) the exact same build file, I'm now getting this same issue.

I am getting the error even when building with simply xcaddy build --with github.com/caddy-dns/porkbun and no other modules, so it does not appear to be a compatibility issue.

EDIT: Silly of me not to check, I hadn't realized Caddy updated to 2.8 today. That explains why it's happening now, at least.

Monviech commented 3 months ago

Right now Im maintaining a small patch that fixes the issue in the build I maintain. I made a PR in libdns/porkbun too. I hope its going to be looked at some point.

Right now I build it like this to avoid the error:

https://github.com/opnsense/tools/blob/16e30f6f99e5ee9c2726cf8c01d50e33985b7257/config/24.1/make.conf#L105-L106

so two --with, one for porkbun, and one for libdns with custom patch.

halphalp commented 3 months ago

i'm also receiving this error after trying to recreate caddy using the latest 2.8 image. note this is the only module i'm using to build caddy:

FROM caddy:2-builder-alpine AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/porkbun

FROM caddy:2-alpine

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

edit: reverting back to caddy v2.7.6 allows it to build, so this module needs updated before uses can upgrade to caddy v2.8.

woolmonkey commented 3 months ago

Same getting error building on 2.8. @Monviech thanks for the patch it works fine.

Vorteth commented 3 months ago

@woolmonkey, what script are you running to build with 2.8?

I tried the two --with and it still fails at the same spot.

adidalal commented 3 months ago

xcaddy build --with github.com/caddy-dns/porkbun --replace github.com/libdns/porkbun=github.com/Monviech/libdns-porkbun@main should do the trick (at least until a new release of libdns/porkbun is created)

Vorteth commented 3 months ago

@adidalal, will that work with 2.8?

Niallfitzy1 commented 3 months ago

New releases of libdns/porkbun & caddy-dns/porkbun are now published I've compiled V2.8.4 with this plugin successfully, so I think we're good now thanks to @Monviech helping out

Vorteth commented 3 months ago

Thank you all!!!

Monviech commented 3 months ago

@Niallfitzy1 thank you a lot :D