-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCP Request is missing required authentication credential #704
Comments
Update your image, |
Sorry forgot to update that line in the template, it's actually 2.6.0 built on 2024-02-03
|
can you check again please? |
Can you try with the latest image (pull it)? I recently upgraded the gcp dependency, maybe this solves it? |
updated to the latest version, still having same issue: Full logs:
|
Last questions before I jump in verifying the code, was it ever working before for you? Have you tried with another program to verify your credentials are correct? Thanks! |
No, this is first time I use ddns-updater. I tried on multiple platform, all result in same error.
Yes, I have verified the credentials with gcloud cli
and also I tried copy part of the source code from package main
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"github.com/qdm12/ddns-updater/internal/provider/constants"
ddnserrors "github.com/qdm12/ddns-updater/internal/provider/errors"
"github.com/qdm12/goshutdown"
clouddns "google.golang.org/api/dns/v1"
"google.golang.org/api/googleapi"
"google.golang.org/api/option"
)
func main() {
// Raw JSON string
raw_creds := `{
"type": "service_account",
"project_id": ......
}`
// Assign the raw JSON string to a variable of type json.RawMessage
credentials := json.RawMessage(raw_creds)
_, ctx, _ := goshutdown.NewGoRoutineHandler("runner")
ddnsService, err := clouddns.NewService(ctx, option.WithCredentialsJSON(credentials))
if err != nil {
fmt.Printf("Error creating DNS service: %s\n", err)
return
}
rrSetsService := clouddns.NewResourceRecordSetsService(ddnsService)
fqdn := fmt.Sprintf("%s.%s.", "", "xxx.xxx")
recordType := constants.A
recordResourceSet, err := getResourceRecordSet(rrSetsService, fqdn, recordType)
if err != nil {
fmt.Printf("Error getting resource record set: %s\n", err)
return
}
for _, rrdata := range recordResourceSet.Rrdatas {
if rrdata == "108.222.111.002" {
// already up to date
fmt.Print("ip ")
}
}
}
func getResourceRecordSet(rrSetsService *clouddns.ResourceRecordSetsService,
fqdn, recordType string) (resourceRecordSet *clouddns.ResourceRecordSet, err error) {
resourceRecordSet, err = rrSetsService.Get("my-project", "my-zone", fqdn, recordType).Do()
if err != nil {
googleAPIError := new(googleapi.Error)
if errors.As(err, &googleAPIError) && googleAPIError.Code == http.StatusNotFound {
return nil, fmt.Errorf("%w: %w", ddnserrors.ErrRecordResourceSetNotFound, err)
}
return nil, err
}
return resourceRecordSet, nil
} |
Hmm strange, your code looks rather similar to the one in ddns-updater, maybe it's just the json credentials not being parsed/read correctly. I've done two things:
Thanks! |
TLDR: using GCP provider is unable to update due to 401 error "CREDENTIALS_MISSING"
Is this urgent: Yes
DNS provider(s) you use: GCP
Program version:
Running version 2.6.0 built on 2024-02-03T18:57:00Z (commit c338c28ce3ab3aa9948f0fe133307b75fe6d34d2)
What are you using to run the container: docker in Mac / windows binary(exe file) / container in TrueNas
Extra information (optional)
Logs:
Configuration file:
Host OS: Windows10/MacOS/Debian12
The text was updated successfully, but these errors were encountered: