Bug: Unable to upload pdf using data key.

 var pdf = fs.readFileSync("/Users/yyy/Downloads/xxx.pdf, { encoding: "base64" });
var r = await swell.put('/accounts/xxxx', {
    content : {
      proof_of_business: {
        file : {
          content_type: "application/pdf",
          filename: "some file.pdf",
            data: { 
              $binary: pdf, 
              $type: "00" 

This does not work. Error

Error: Object fields contain "$" or "." and are not valid for storage. (cmd: "update", query: {"query":{"_idโ€:โ€xxxโ€},โ€update":{"$set":{"content":{"proof_of_business":{"idโ€:โ€xxxโ€,โ€length":31,"date_uploaded":"2022-06-22T06:16:47.588Z","content_type":"binary/octet-stream","md5โ€:โ€yyyโ€,โ€url":"https://cdn.schema.io/yyyโ€,โ€file":{"content_type":"application/pdf","filename":"some file.pdf","url":"file:////Users/yyy/Downloads/xxxโ€.pdf,โ€data":{"$binary":"JVBERi0xLjMKJeLjz9โ€ฆ.


  • Addendum:

    Upon upload, the field looks like the following in Swell entity

    If one tries to download and open it, it appears as

Sign In or Register to comment.