How to avoid "Membuffer overrun" in Node.js Evernote API 2.0.0-beta

151 views Asked by At

Using the new API, I get a MemBuffer Overrun Exception with the following code:

var evernoteClient =  new Evernote.Client({token: process.env.EVERNOTE_TOKEN});

var store = evernoteClient.getNoteStore(process.env.EVERNODE_NODESTORE);
var filter = new Evernote.NoteStore.NoteFilter();
filter.words = "tag:ttesstt";
var spec = new Evernote.NoteStore.NotesMetadataResultSpec();
spec.includeTitle = true;
spec.includeAttributes = true;
console.log(spec);

store.findNotesMetadata(filter,0,1,spec)
  .then(result=> {
    console.log("RESULT", result.notes[0].guid)
    var noteSpec = new Evernote.NoteStore.NoteResultSpec()
    noteSpec.includeContent = true;
    store.getNoteWithResultSpec(result.notes[0].guid, noteSpec)
        .then( note => {
          console.log("NOTE", note)
        })
  })
  .catch(err=>{console.log("ERR:", err)})

With this stacktrace:

Error: MemBuffer overrun
at Error (native)
at MemBuffer.read (/app/node_modules/evernote/lib/thrift/transport/memBuffer.js:29:55)
at BinaryProtocol.readString (/app/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:333:29)
at BinaryProtocol.readType (/app/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:353:25)
at Object.Thrift.Struct.readFields (/app/node_modules/evernote/lib/thrift/thrift.js:505:49)
at Thrift.Struct.read (/app/node_modules/evernote/lib/thrift/thrift.js:485:19)
at Object.Thrift.Struct.readFields (/app/node_modules/evernote/lib/thrift/thrift.js:503:53)
at Thrift.Struct.read (/app/node_modules/evernote/lib/thrift/thrift.js:485:19)
at Thrift.Method.processResponse (/app/node_modules/evernote/lib/thrift/thrift.js:204:26)
at .<anonymous> (/app/node_modules/evernote/lib/thrift/thrift.js:165:42)

No such error occurs if I set includeContent to false by changing line 15 to:

noteSpec.includeContent = true;

Is there a way to avoid this error?

0

There are 0 answers