cloudflare / node-cloudflare

Node.js API for Client API
https://cloudflare.github.io/node-cloudflare/
Other
335 stars 92 forks source link

Error passing options into KV addMulti #75

Closed nicovigil1 closed 4 years ago

nicovigil1 commented 4 years ago

Error: Failure: Cloudflare: Unknown arguments ([object Object]). Did you mean to pass an options object? (on API request to PUT accounts/:accountId/storage/kv/namespaces/:namespaceId/bulk)

Code: await cf.enterpriseZoneWorkersKV.addMulti(accountID, namespaceID, kv, {base64: true});

The KV is in the structure

{
  key: 'key' (string)
  value: 'value' (typeof Buffer)
}
nicovigil1 commented 4 years ago

solved it - Apparently you need to add { buffer: true } to each record

{
  key: 'key' (string)
  value: 'value' (typeof Buffer)
  buffer: true (boolean)
}