JS: A non-empty ArrayBuffer, BufferView or Buffer is expected.

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      Setting a non-optional data property to an empty buffer.

      Expected Results & Code Sample

      I would expect the following test to pass:

      const Realm = require("realm");
      const realm = new Realm({
        schema: [{
          name: "Test",
          properties: { blob: 'data?' },
        }],
      });
      
      realm.write(() => {
        realm.create("Test", { blob: new ArrayBuffer(0) })
      });
      

      Actual Results

      This error is thrown:

      Error: A non-empty ArrayBuffer, BufferView or Buffer is expected.
      

      Steps to Reproduce

      Save the code above as index.js in an empty directory and run

      npm init -y && npm install realm && node index.js
      

      Version of Realm and Tooling

      • Realm JS SDK Version: 10.1.4
      • Node or React Native: Node
      • Client OS & Version: v12.20.0

            Assignee:
            Cesar Valdez (Inactive)
            Reporter:
            Kræn Hansen
            Archiver:
            Marc Greenfield

              Created:
              Updated:
              Resolved:
              Archived: