go-cloud
go-cloud copied to clipboard
writer.Close() failed and return PermissionDenied error
writer.Close()
Close writer failed.
error: code=PermissionDenied): gocloud.dev/blob.(*Writer).Close /go/pkg/mod/[email protected]/blob/blob.go:341
- googleapi: Error 403: [email protected] does not have storage.objects.delete access to the Google Cloud Storage object., forbidden"
This is working as intended and expected.
Per https://pkg.go.dev/gocloud.dev/blob#Writer.Close, Close closes the blob writer. The write operation is not guaranteed to have succeeded until Close returns with no error.
In this case, it looks like you are trying to write on top of an existing blob, and GCS requires the storage.objects.delete permission to do that (https://stackoverflow.com/q/66129154), which makes sense.