[LOGIN ERROR] AttributeError: 'User' object has no attribute 'get_restricted_ip_list'

After updating node when trying to login i get this error:

raceback (most recent call last):
File “/home/crmmanager/erpnext/apps/frappe/frappe/app.py”, line 53, in application
init_request(request)
File “/home/crmmanager/erpnext/apps/frappe/frappe/app.py”, line 120, in init_request
frappe.local.http_request = frappe.auth.HTTPRequest()
File “/home/crmmanager/erpnext/apps/frappe/frappe/auth.py”, line 51, in init
frappe.local.login_manager = LoginManager()
File “/home/crmmanager/erpnext/apps/frappe/frappe/auth.py”, line 105, in init
if self.login()==False: return
File “/home/crmmanager/erpnext/apps/frappe/frappe/auth.py”, line 137, in login
self.post_login()
File “/home/crmmanager/erpnext/apps/frappe/frappe/auth.py”, line 141, in post_login
validate_ip_address(self.user)
File “/home/crmmanager/erpnext/apps/frappe/frappe/auth.py”, line 414, in validate_ip_address
ip_list = user.get_restricted_ip_list()
AttributeError: ‘User’ object has no attribute ‘get_restricted_ip_list’

HELP :frowning:

Please say the version ERPNext , operating environment, how nodejs was updated and to what version.

Have you tried: bench update --requirements ?

ERPNext V12, Development on Ubuntu 18.04.4 LTS

NodeJS v10.20.1 via terminal

I tried that already, tried restoring sites from backups, no luck

Thanks for answering

The function exists, you can check

Can you check if you’re frappe app is up to date with version-12 ?

$ bench version
erpnext 12.x.x-develop
frappe 12.x.x-develop

Yes, function exists

When trying to create new account I get this two errors on console:

jquery.min.js:4:
POST https://sipradius.com/ 500 (INTERNAL SERVER ERROR)

Traceback (most recent call last):
File “/home/crmmanager/erpnext/apps/frappe/frappe/app.py”, line 59, in application
response = frappe.handler.handle()
File “/home/crmmanager/erpnext/apps/frappe/frappe/handler.py”, line 30, in handle
data = execute_cmd(cmd)
File “/home/crmmanager/erpnext/apps/frappe/frappe/handler.py”, line 69, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/crmmanager/erpnext/apps/frappe/frappe/init.py”, line 1086, in call
return fn(*args, **newargs)
File “/home/crmmanager/erpnext/apps/frappe/frappe/core/doctype/user/user.py”, line 785, in sign_up
user.add_roles(default_role)
AttributeError: ‘User’ object has no attribute ‘add_roles’

Okay, looks like you’re using the develop branch.
Either way, we haven’t encountered any such issues with vanilla frappe and erpnext. Have you made any customizations?

you can run git reset --hard <upstream-branch-name>/develop to reset any changes locally

Some minor ones in erpnext/templates/generators/item/

made them about a week ago, no problems until last night after update

$ git reset --hard
HEAD is now at 9513171d3f

still error showing

ERPNext should not cause this problem. Can you run bench --site <site-name> clear-cache and restart your server with bench restart

Nothing. Error still there, this in happening to all sites

I suspect local modifications on your site. The commit hash 9513171d3f does not match any ref from develop branch

When was the list time you updated frappe and erpnext? If it has been updating frequently, you can pull from upstream on a separate branch.

You can run git fetch upstream develop:<new-branch-name> and then `git checkout

Last update was probably before modifications on erpnext/templates/generators/item/

$ git checkout
Your branch is up to date with 'upstream/develop

It is weird because error started last night, no modifications were made last night, just updates to server

Error still there

Can you try: sudo npm update -g ?

Just tried it, it ran smoothly, follow by a bench restart
error persists.

Maybe this is relevant? when running bench setup socketio i get this:

npm WARN saveError ENOENT: no such file or directory, open ‘/home/crmmanager/erpnext/package.json’
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/babel-cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
npm WARN enoent ENOENT: no such file or directory, open ‘/home/crmmanager/erpnext/package.json’
npm WARN erpnext No description
npm WARN erpnext No repository field.
npm WARN erpnext No README data
npm WARN erpnext No license field.

  • redis@3.0.2
  • babel-cli@6.26.0
  • superagent@5.2.2
  • socket.io@2.3.0
  • babel-preset-es2015@6.24.1
  • less@3.11.1
  • cookie@0.4.1
  • babel-preset-es2016@6.24.1
  • chokidar@3.4.0
  • express@4.17.1
  • babel-preset-es2017@6.24.1
  • babel-preset-babili@0.1.4
  • babel-core@6.26.3
    updated 13 packages in 4.204s

No solution was ever found, decided to reinstall OS and fresh install