cloudflare / cloudflare/cloudflare-rs

Response deserialization error - KV Write multiple key-value pairs

Open
#248 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
316
Forks
111
PR merge metrics
No merged PRs in 30d

Description

Recently calls to the endpoint to write multiple key-value pairs to a KV Store started failing with the error message: `error decoding response body: invalid type: map, expected unit at line 2 column 12`.

I tried to replicate the same call I was doing through the library with Postman, and the response is a success. I dug in the Cloudflare documentation and I think there was an update that broke the deserialization of the response.

See the current version of the docs: https://developers.cloudflare.com/api/operations/workers-kv-namespace-write-multiple-key-value-pairs.
And the old one: https://web.archive.org/web/20240527181949/https://developers.cloudflare.com/api/operations/workers-kv-namespace-write-multiple-key-value-pairs.

Steps to reproduce:
```rust
let cloudflare_client: cloudflare::framework::async_api::Client = todo!();
let pair = cloudflare::endpoints::workerskv::write_bulk::KeyValuePair {
key: "key".to_string(),
value: "value".to_string(),
expiration: None,
expiration_ttl: None,
base64: None,
};
let request = cloudflare::endpoints::workerskv::write_bulk::WriteBulk {
account_identifier: "",
namespace_identifier: "",
bulk_key_value_pairs: vec![pair],
};
cloudflare_client.request(&request).await?;
```

Cloudflare response body:
```json
{
"result": {
"successful_key_count": 1,
"unsuccessful_keys": []
},
"success": true,
"errors": [],
"messages": []
}
```

For additional context: I'm currently on the v0.11.0 version of the library.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.