How to get user Id in a Cloud Function?

I am trying to get the user’s id as a string.
I need to use id to do different validations.

I tried this at the top of my cloud function and I can pull other things about the user, but no id.

const user = request.user;
const userId = user.get('objectId'); //returns undefined ('id' as well)
const ethAddress = user.get('ethAddress'); //works

I found this thread, but I wasn’t able to follow the conclusion: Can not get user by objectId Moralis.User [SOLVED]

I can’t conceive a way to reliably query the user without id either. How can I do this?

I partially solved it with their weird code…

    if (!request.user) throw 'You must log in again.'
    const user = JSON.parse(JSON.stringify(request.user));; //got it! is probably enough

It’s weird but it spits a bunch of errors at me when I take off those JSON functions.

it looks like this works fine:

Moralis.Cloud.define('user_id', (request) => {