Can't return value other than string or object with invoke from resolver

Hi,

No problem to return a string or an object from a resolver, but when I try to return something different, like a Blob, I receive nothing.

// resolvers/index.js
const resolver = new Resolver();

resolver.define('getBlob', async (req) => {
  const data = new Blob(['Test']);
  return data;
});

resolver.define('getObject', (req) => {
  const data = { test: 'what' };
  return data;
});
// frontend/index.jsx
const myBlob = await invoke('getBlob')
console.log(myBlob);
const myObject = await invoke('getObject')
console.log(myObject);

In the console, myBlob is empty and myObject is okay:

Any idea of what I am doing wrong?
Thanks for your help!

1 Like

Hi Bertrand,

At present all results returned from resolvers have to be JSON serializable. Can you describe to me your use case?

2 Likes

Hi @JamesDumay ,

That was my problem: I was trying to return something not serializable… It’s fixed (even if it was not that easy because I had to deal with Buffers and ArrayBuffers, and serialization was not straight forward for me :smiley: )
Thank you!

2 Likes