User Password Update Issue

I’m currently getting an internal server error when multiple users update their passwords at the same time. The first few users will work without issues, but then the next users will receive a 500 error. My users are working with iPads, so all they see is the spinning wheel next to the “Change Password” button. After a few minutes, users are able to update their passwords again but then the same issues persist.

It seems that the AJAX request is being constructed properly, as the form data is being serialized and sent correctly as seen in my browser’s devtools, but the error in the Nextcloud log states the following:

[index] Error: TypeError: Argument 3 passed to OC\Settings\Controller\ChangePasswordController::__construct() must be of the type string, null given at <<closure>>
 0. <<closure>>
    __construct("settings", OC\AppFramework\Http\Request {}, null, OC\User\Manager {}, OC\User\Session {}, OC\Group\Manager {}, OC\App\AppManager {}, OC\L10N\L10N {})
 1. /snap/nextcloud/15565/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php line 81
    newInstanceArgs(["settings",OC\A ... }])
 2. /snap/nextcloud/15565/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php line 98
    buildClass(ReflectionClass  ... "})
 3. /snap/nextcloud/15565/htdocs/lib/private/AppFramework/Utility/SimpleContainer.php line 119
    resolve("OC\\Settings\\C ... r")
 4. /snap/nextcloud/15565/htdocs/lib/private/AppFramework/DependencyInjection/DIContainer.php line 422
    query("OC\\Settings\\C ... r")
 5. /snap/nextcloud/15565/htdocs/lib/private/AppFramework/DependencyInjection/DIContainer.php line 397
    queryNoFallback("OC\\Settings\\C ... r")
 6. /snap/nextcloud/15565/htdocs/lib/private/AppFramework/App.php line 105
    query("OC\\Settings\\C ... r")
 7. /snap/nextcloud/15565/htdocs/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    main("OC\\Settings\\C ... r", "changePersonalPassword", OC\AppFramework\ ... {}, {_route: "settin ... "})
 8. <<closure>>
    __invoke({_route: "settin ... "})
 9. /snap/nextcloud/15565/htdocs/lib/private/Route/Router.php line 297
    call_user_func(OC\AppFramework\ ... {}, {_route: "settin ... "})
10. /snap/nextcloud/15565/htdocs/lib/base.php line 987
11. /snap/nextcloud/15565/htdocs/index.php line 42

POST /index.php/settings/personal/changepassword

When I looked to see what this argument is supposed to be, I found the AppPasswordController::__construct method:

public function __construct(string $appName,
								IRequest $request,
								string $userId,
								IUserManager $userManager,
								IUserSession $userSession,
								IGroupManager $groupManager,
								IAppManager $appManager,
								IL10N $l) {
		parent::__construct($appName, $request);
		$this->userId = $userId;
		$this->userManager = $userManager;
		$this->userSession = $userSession;
		$this->groupManager = $groupManager;
		$this->appManager = $appManager;
		$this->l = $l;

So it seems the app is suggesting that the $userId variable is null, but this only happens after a couple of people have successfully updated their passwords so I’m confused as to how this is happening to start with, and where the problem truly lies. Any help with this would be very much appreciated.