What I’m trying to do:
Hey everyone. I have a simple login form where users need to fill in their email and password and if the user exists and is enabled, they should be able to proceed.
My functions and forms work correctly, but there is still an annoying [An internal error has occurred] notification that pops up in the output console. Everything seems to work. Only valid users can sign in and if the user doesnt exist, it doesn’t allow them to proceed. But what can I do to get rid of the pesky error?
What I’ve tried and what’s not working:
Code Sample:
class LoginForm(LoginFormTemplate):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
def login_btn_click(self, **event_args):
"""This method is called when the button is clicked"""
user = anvil.users.get_user()
print(f'User: {user}') # Should print 'None' if no one is signed in
anvil.users.login_with_form()
print('Form has been filled in.')
user = anvil.users.get_user()
print(f'User: {user}') # Should print 'None' if no one is signed in
Notification('Successfully signed in.').show()
open_form('NavBarForm')
The output from the above for a successful login is as follows:
OUTPUT CONSOLE:
User: None
[An internal error has occurred]
Form has been filled in.
User: <LiveObject: anvil.tables.Row>
So as you can see, I manage to sign in successfully and everything else works, but the error remains.
This only occurs when I sign in with email and password (ie no existing user signed in already). If I don’t logout from a previous session and I click on the Login button, then no error arises.
thanks for that - when you run it with a published link - what does the error message say in anvil’s red error reporting component, the one in the bottom right corner?
We’re narrowing it down - no red anvil indicator means that it’s only an error in the IDE.
If you try running the app in the IDE but in a new tab:
And repeat the steps in the browser dev tools console
You might be able to see the error, but Unknown error probably means what you do see won’t be that helpful either.
It could be a number of things
Are you using JavaScript in Native Libraries?
Do you have many browser extensions?
You can also share a clone link to this thread and I can take a look
Or, if there is sensitive information you can share a clone link with me as a private message
(and steps to reproduce)
Just thought I would provide an update on this error. It seems like it only happens in the classic editor. With the beta editor, I haven’t come across it again.