Update the value of a field in the User table for a particular user

How do I update the value of a particular field in the User table for a particular user?

Here’s my code:

Moralis.Cloud.afterSave("EthTransactions", async function(request) {
  // From the User table lookup the user with Id equal to "1234".
  // For this user, update the value in the "Hobby" column to "Reading".
  
  const query = await new Moralis.Query("User");
  query.equalTo("Id", "1234");
  const result = await query.first();
  result.set("Hobby", "Reading");
  await result.save();
});

Currently I get the following error:

TypeError: result.set is not a function

Try to see what you have in result. Maybe it didn’t find anything.

Thanks for your reply. result seems to be non-null. This is the output of logger.info(result);

result is [object Object]

you can see that result by using logger.info(JSON.stringify(result))

result is indeed undefined. So the problem seems to be in that const result = await query.first() returns empty result.
My actual query is query.equalTo("ethAddress", "0x123...") and I have made sure there is an entry with this ethAddress in the User table.

Any idea why the query returns empty?

This is a blocker for me. Any help would be appreciated.

you may need to use master key here: https://docs.moralis.io/moralis-server/cloud-code/cloud-functions#using-the-master-key-in-cloud-code