Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-1034

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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 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@mongodb.com Cesar Valdez (Inactive)
            Reporter:
            kraen.hansen@mongodb.com Kræn Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: