Cannot manually detect new LDAP user

I have a Nextcloud 16.0.4 server that’s integrated with LDAP for authentication and I’m building a script that creates a system wide user so it first creates the user in LDAP and then adds that user to some Nextcloud groups.

The problem I’m facing is that Nextcloud didn’t import the user from LDAP by the time the script wants to add it to a Nextcloud group. I know there’s a background job that periodically checks the LDAP for changes, but I need a way to force Nextcloud to import the user from LDAP. I’ve tried running

./occ ldap:check-user test.user

But it says “The given user is not a recognized LDAP user.” Although I can use that command to manually detect when a user was deleted from LDAP. I’ve also tried using

./occ ldap:search test

But this doesn’t return anything.