Wrangler KV Bulk import

Hi Guys,

After solving an issue with redirection workers script (Redirects using KV to store redirect map). I am having difficulty using wrangler to bulk import the key values.

The test bulk import file is failing when the value contains json format.

[

{ "key": "/testfourten/", "value": "{ "code": 410 }" }, 
{ "key": "/testredirect2/", "value": "{ "dest": "https://test.com/test/", "code": 301 }"}

]

The wrangler error is:

Error: Failed to decode JSON. Please make sure to follow the format, [{“key”: “test_key”, “value”: “test_value”}, …]

Does anyone know if this is a known limitation with wrangeler kv:bulk ?

Using wrangler to put the key and value directly stripped the leading trailing slashes from the key (pathname). If that worked I was thinking of using a foreach loop to add the keys and values from a CSV

Any insights appreciated
Thanks
Gavan

The JSON you posted is not valid JSON. You should double check what you are sending.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.