I've been doing it this way for a while.
Everything is working fine for the last two months and out of nowhere this error comes up, 'Non-alphanum char in element with leading alpha:' When trying to update on firestore. I don't even know where to begin looking for the issue.
# returns true if update was successful
def UpdateUser(self, user):
try:
# update will fail if it cant find an already existing document
doc_ref = self._db.collection(USER).document(user._username)
# update the values | this will fail if it doesn't exist
doc_ref.update({
u'Username': user._username,
u'Password': user._password,
# u'Time Created': user._time_created,
u'Last logged in': user._last_logged_in,
u'Active': user._active,
u'Phone': user._phone,
u'Address': user._address,
u'State': user._state,
u'City': user._city,
u'Zipcode': user._zipcode,
u'Stripe Customer Id': user._stripe_customer_id,
u'Email Activated': user._email_activated,
u'Full Name': user._full_name,
u'Id': user._id,
u'Group Ids': user._group_ids,
})
return True
except Exception as e:
print(e)
print("Failed to update {}".format(user._username))
return False
I expect the output to be a successful update, but it seems to throw an error.