Cannot login after bench update - Uncaught TypeError: frappe.utils.xss_sanitise is not a function

Ok guys, so I’ve just logged into the server and ran bench update as well as git pull as it the messaged showed there are modifications done in app frappe … although there were never any changes done to my erpnext.

The problem, I cannot login into any account.

Here’s what the console errors show:

Uncaught TypeError: frappe.utils.xss_sanitise is not a function
at HTMLFormElement. ((index):414)
at HTMLFormElement.dispatch (jquery.min.js:3)
at HTMLFormElement.r.handle (jquery.min.js:3)

Any idea what to do ?

run the update again

Hi

First you can clear cache of browser to load new js libs,

If still not run, and your system is development branch, If yes should change to production branch.

sudo bench setup production

3 Likes

Hi,

I ran bench update a few times, but I am not able to go beyond the login screen. The browser console shows: TypeError: frappe.utils.xss_sanitise is not a function

I tried clearing the cache with:

bench clear-cache
and
bench clear-website-cache

but still, not able to go beyond the login screen, and getting the same error in the browser console. How to resolve it?

Thanks
Uma

Be sure to clear the browser history & cache of cookies - that worked here too to resolve the problem [Solved] Bench update from v9 to v10 failed due to npm install failure which caused by Chinese government blocked googleapis.com

Hi Clarke,

Thanks for responding. I have cleared everything from the browser, including cache and cookies too, but still getting the same error. I am using Mozilla Firefox on Ubuntu.

Thanks
Uma

Try Chrome to confirm the same problem?

Hi @UmaG

same as you, I try to clear cache, Fix quickly you can edit code,

\apps\frappe\frappe\templates\includes\login\login.js

line 20

args.usr = frappe.utils.xss_sanitise(($("#login_email").val() || "").trim());

change to

args.usr = ($("#login_email").val() || "").trim();

This is not good but help you login with current code

I installed Google Chrome, and this is the error on my browser console too.

Uncaught TypeError: frappe.utils.xss_sanitise is not a function
at HTMLFormElement. (login:436)
at HTMLFormElement.dispatch (jquery.min.js:3)
at HTMLFormElement.r.handle (jquery.min.js:3)

You updated and that login code has changed in recent weeks:

XSS on Login Page · Issue #11750 · frappe/erpnext · GitHub
[FIX] Fix XSS by achillesrasquinha · Pull Request #4560 · frappe/frappe · GitHub

The code may have a scope problem
javascript - Explain this Uncaught TypeError: Property 'x' of object [object Object] is not a function - Stack Overflow

But why your error report is not more common as others update is the question…

@tundebabzy @achillesrasquinha please note this recent report for your advice, thanks

Thanks @vinhnguyent090, :slight_smile:

The temporary fix works, and I am able to get onto the system. Hope there is a permanent fix too to the problem, though.

Thanks
Uma

1 Like

Hi,

I’m experiencing the exact same error too after bench update! The issue with clearing browser cache in our case is the risk of losing unsynced invoices for the offline POS. I would really like to proceed without having to edit core code

Any advice?

Thanks

Got same error when upgradeing to v13

Had to do the following:
352 bench switch-to-branch version-13-beta frappe erpnext --upgrade
354 bench update --patch
355 bench build
356 bench setup requirements
360 yarn install
364 npm cache clean -f
366 sudo npm install -g n
368 sudo n stable
370 bench setup requirements
371 bench build

1 Like