[8.0] system.user.editUser throwing GatewayException Post Error 504

Good morning,

I’m receiving a GatewayException: Post Error, error code = 504 error when attempting to run system.user.editUser() in the script console. When checking the results I see that the user’s information does indeed change as expected, but the error still gets thrown for some reason. For reference I’ve got Administrator access and the Permissions for User Management is enabled with no required client roles. Is there something I might be missing? Code is below (last line throws the error):

def editContactInfo(user, contactMethod, oldValue, newValue):
	if oldValue == newValue : return
	
	contactMethods = {
		'Email' 	: 'email',
		'Phone' 	: 'phone',
		'SMS' 	: 'sms'
	}
	
	if contactMethod not in contactMethods : return
	
	# Retrieve the user we're going to edit
	userToChange = system.user.getUser("", user)
	print userToChange
	
	if userToChange is None : return
	
	#if old value isn't blank, we need to remove it from the user's contact info
	if oldValue != '':
		userToChange.removeContactInfo(contactMethods[contactMethod], oldValue)
	
	if newValue != '':
		userToChange.addContactInfo({contactMethods[contactMethod] : newValue})
		
	# Edit the user. Because the user object we're passing in has a user name, the function
	#   already knows which user to edit
	print system.user.editUser("", userToChange)