cloudflare-go
cloudflare-go copied to clipboard
SetWorkersSecret doesn't work for unencrypted, fails if unencrypted already set
Confirmation
- [X] My issue isn't already found on the issue tracker.
- [X] I have replicated my issue using the latest version of the library and it is still present.
cloudflare-go version
v0.60.0
Go environment
GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/Users/slester/Library/Caches/go-build" GOENV="/Users/slester/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/slester/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/slester/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/opt/homebrew/Cellar/go/1.19.5/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/opt/homebrew/Cellar/go/1.19.5/libexec/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.19.5" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/slester/src/github.com/cloudflare/cloudflare-go/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bb/mj30xnl142bg3fpz78c_g1700000gn/T/go-build3396119799=/tmp/go-build -gno-record-gcc-switches -fno-common"
Expected output
I'm trying to use the Workers API to update a secret (SetWorkersSecret with type text). The comment in the Go library says "SetWorkersSecret creates or updates a secret" that already exists as an environment variable (plain text).
Actual output
"global variable VAR_LIST already set (10053)"
Code demonstrating the issue
res, err := s.api.SetWorkersSecret(ctx, workerName, &cloudflare.WorkersPutSecretRequest{
Name: key,
Text: value,
Type: "text",
})
Still tries to put it as an encrypted (secret_text) and fails if unencrypted is already set
Steps to reproduce
See code
References
No response
can you expand on your steps to reproduce here? a minimal runnable go file would be great to show how/where your issue is happening.