How to read Amazon QLDB history function result?

42 views Asked by At

I'm working with Amazon QLDB and NodeJs. I'm writing a function to return History/Revisions against userId. When I tried running my query in the PartiQL editor, I got the expected result and the results were readable.

But when I tried writing NodeJs code and after I ran that code, I got unexpected results saying;

(12) [Proxy, Proxy, Proxy, Proxy, Proxy, Proxy, Proxy, Proxy, Proxy, Proxy, Proxy, Proxy]

12 is the number of records, that is correct. but how can I read Proxy Objects in Array?

Here is my code.

export const fetchUserHistory = async (userId) => {
    console.log('qldb fetchUserHistory start ', userId)
    await qldbDriver.executeLambda(async (txn) => {
        const userHistory = await txn.execute('SELECT * FROM history(user_history) AS h WHERE h.data.userId = ?', userId)

        console.log('qldb fetchUserHistory results ', userHistory.getResultList())
    })
    console.log('qldb fetchUserHistory end ')
}

Here is what I tried to get the expected result:

I tried to use the ION JS library to convert my result to JSON but no luck.

Any help would be appreciated. Thanks in advance.

0

There are 0 answers