Does anyone know how to upload metadata
Does anyone know how to upload metadata with
wrangler kv bulk put
? I tried following the docs, passing the following JSON:
[
{
"key": "key1",
"value": "value1",
"metadata": "{ \"metadata1\": 1 }"
},
{
"key": "key2",
"value": "value2",
"metadata": "{ \"metadata2\": 2 }"
}
]
But I get the following error:
⛅️ wrangler 3.99.0
-------------------
✘ [ERROR] Unexpected JSON input from "kv.json".
Each item in the array should be an object that matches:
interface KeyValue {
key: string;
value: string;
expiration?: number;
expiration_ttl?: number;
metadata?: object;
base64?: boolean;
}
The item at index 0 is {"key":"key1","value":"value1","metadata":"{ \"metadata1\": 1 }"}
The item at index 1 is {"key":"key2","value":"value2","metadata":"{ \"metadata2\": 2 }"}
What kind of object
do we need to pass for the metadata
? In contrast, wrangler kv key put --metadata
does accept a JSON-serialized string and works as expected.
The bulk put
works as expected if I just pass the key
and value
, or with the example provided in the docs (passing an expiration_ttl
).2 Replies
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Ah! Thank you, that did it! I could have sworn I tried that, but I think I forgot to unescape the inner quotes.