I’m having a bit of trouble with a Cloud Function. Maybe someone can help me out. Here’s a simple example to demonstrate my issue:
Moralis.Cloud.define("getNftCreator", async (request) => {
const query = new Moralis.Query("NFT");
query.equalTo("tokenId", request.params.token_id);
result = await query.first();
return {
username: result.attributes.creator.attributes.username,
};
});
I have a class called NFT
that consists of a column called creator
that is a pointer to another class called UserInfo
that contains a username
column.
The problem I’m having is that I can’t access the username via the creator pointer for some reason. If I return just result.attributes.creator
I can see that it is an object with details about the pointer:
{
"__type": "Pointer",
"className": "UserInfo",
"objectId": "3KjBGgoqOdpUDQhGgvvt4gdV"
}
Any ideas on what may be happening here? I thought I should be able to chain the attributes property and get to the pointer data, but it doesn’t seem to be working here.