Skip to content
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

Response deserialization error - KV Write multiple key-value pairs #248

Open
ggregoriAIDEM opened this issue Nov 15, 2024 · 0 comments
Open

Comments

@ggregoriAIDEM
Copy link

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:

    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: "<ACCOUNT_ID>",
        namespace_identifier: "<NAMESPACE_IDENTIFIER>",
        bulk_key_value_pairs: vec![pair],
    };
    cloudflare_client.request(&request).await?;

Cloudflare response body:

{
    "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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant