Check out ManagementClient | auth0 on how to use the ManagementClient from the node client library.
In your case, it would look something like below:
const result = await management.users.get({ id: userId }); // Fetch result
const user = result.data || {}; // extract user from result
Note that the management calls you are making in other parts of your code for Client Grants, Updating users, etc will also need to be updated to prevent getting these errors.
Double check to make sure that process.env.AUTH0_DOMAIN is the actual Auth0 domain that includes the region + auth0.com address
(For example, just $AUTH0_TENANT.$REGION.auth0.com - do not include https:// )