"method not allowed" error in web client after upgrade to 6.4

Hi all, I upgraded trytond from 6.2.6 to 6.4.0, including sao, and now sao shows a “Method not allowed” error immediately after logging in.

Am I missing some critical step in the upgrade? I have followed the same procedure when upgrading within series 6.2 but this is my first upgrade to a new series.

Cheers,
Dale

Procedure:

  1. install --upgrade trytond and modules using pip to 6.4.*
  2. ran the three migration commands as listed in the “Migration from 6.2 to 6.4” post (although the first two commands failed, presumably because there aren’t any payments in the database).
  3. ran trytond-admin -c ./trytond.conf -d scc --all
  4. installed sao-6.4.0
  5. logged in with browser and got “Method not allowed” error

Trytond is not logging to a file, the following errors were in the terminal session used to start trytond:

17575 34432474624 [2022-05-11 14:00:18,841] ERROR werkzeug 10.0.2.2 - - [11/May/2022 14:00:18] code 400, message Bad request syntax ('{"id":17,"method":"model.ir.ui.icon.list_icons","params":[{"client":"339011b3-a73c-4ead-823e-220036ecbf85","company_filter":"one","company":1,"company.rec_name":"Swift Construction Company","language":"en","language_direction":"ltr","groups":[1,4,2,5,3,6],"locale":{"date":"%m/%d/%Y","grouping":[3,3,0],"decimal_point":".","thousands_sep":",","mon_grouping":[3,3,0],"mon_decimal_point":".","mon_thousands_sep":",","p_sign_posn":1,"n_sign_posn":1,"positive_sign":"","negative_sign":"-","p_cs_precedes":true,"n_cs_precedes":true,"p_sep_by_space":false,"n_sep_by_space":false}}]}POST /scc/ HTTP/1.1')
17575 34432474624 [2022-05-11 14:00:18,841] INFO werkzeug 10.0.2.2 - - [11/May/2022 14:00:18] "None /scc/ HTTP/1.1" HTTPStatus.BAD_REQUEST -

sao error:

I guess this did not work correctly.
Clearly the server running is not from 6.4 series.

Hi @ced, trytond and modules all show 6.4.0.

(env) [tryton@starlord ~/trytond]$ pip list | grep tryton
trytond                       6.4.0
trytond-account               6.4.0
trytond-account-invoice       6.4.0
trytond-account-invoice-stock 6.4.0
trytond-account-product       6.4.0
trytond-company               6.4.0
trytond-country               6.4.0
trytond-currency              6.4.0
trytond-party                 6.4.0
trytond-product               6.4.0
trytond-purchase              6.4.0
trytond-stock                 6.4.0
(env) [tryton@starlord ~/trytond]$

I created a script that ran pip install --upgrade for all my installed modules. I did have to run the script twice though to deal with module dependencies (the first time some upgrades failed because their dependencies hadn’t been upgraded yet).

(env) [tryton@starlord ~/trytond]$ head ~/bin/upgrade_trytond_6.4.sh
#!/bin/sh

echo
echo "trytond"
pip install --upgrade "trytond==6.4.*"

echo
echo "trytond-account"
pip install --upgrade "trytond-account==6.4.*"

(env) [tryton@starlord ~/trytond]$

After pip upgrade I started trytond and ran the “Migration from 6.2 to 6.4” instructions in trytond-console (although the first 2 commands failed, I presume because I don’t have any payments yet in my database).

I then ran “trytond-admin -c ./trytond.conf -d scc --all”, and then upgraded sao. The sao upgrade process reported 3 high severity vulnerabilities and a new minor version of npm was available, but no errors. After that I logged in with a web browser, and then the “Method not allowed” error was reported.

Is it possible there are system dependencies which I must also upgrade? I only upgraded trytond, the trytond modules, and sao (and NOT proteus).

Thanks,
Dale

Fwiw, this is the complete venv:

(env) [tryton@starlord ~/trytond]$ pip list
Package                       Version
----------------------------- ---------
certifi                       2021.10.8
charset-normalizer            2.0.12
defusedxml                    0.7.1
forex-python                  1.8
Genshi                        0.7.6
idna                          3.3
lxml                          4.8.0
passlib                       1.7.4
pip                           22.0.4
polib                         1.1.1
proteus                       6.2.3
psycopg2                      2.9.3
pycountry                     20.7.3
python-dateutil               2.8.2
python-magic                  0.4.25
python-sql                    1.3.0
python-stdnum                 1.17
relatorio                     0.10.0
requests                      2.27.1
setuptools                    56.0.0
simpleeval                    0.9.12
simplejson                    3.17.6
six                           1.16.0
sqlite3                       0.0.0
trytond                       6.4.0
trytond-account               6.4.0
trytond-account-invoice       6.4.0
trytond-account-invoice-stock 6.4.0
trytond-account-product       6.4.0
trytond-company               6.4.0
trytond-country               6.4.0
trytond-currency              6.4.0
trytond-party                 6.4.0
trytond-product               6.4.0
trytond-purchase              6.4.0
trytond-stock                 6.4.0
urllib3                       1.26.9
Werkzeug                      2.1.1
wrapt                         1.14.0
(env) [tryton@starlord ~/trytond]$
````Preformatted text`

P.S. I installed the latest version of the tryton client and it works correctly (the “method not allowed” error only occurs in the web client).

I’ve my werkzeug dependency at 2.1.2, maybe it’s worth a try upgrading it since it’s known that pallet dependencies gave some issues, as discussed on Howto deal with Pallets Projects dependencies

You could try also to downgrade it to 2.0.* since it should be supported if I’m correct.

If that doesn’t solve your issue I’ve no idea :frowning:

The error is raised because sao is calling a method that does not exist on the server. This is clearly a sign of running new verison of sao with old version of tryton.

Could you check the output of: trytond --version ? If this shows 6.4.x its a clear sign that you have updated correctly the server.

Please note that you should restart the server to run the new series. Maybe sao is conecting to an older series server?

Maybe you did a pip install without an activated virtual environment, it’s easy overlooked. So try to run the trytond --version with and without an activated virtual environment. If you don’t get an error back in the last case, you have accidentally installed a tryton version outside your virtual environment and you have to uninstall that one.

Finally I do not think it is a version issue because the method model.ir.ui.icon.list_icons exists since a long time.
But there are some strange things in your report. The logging shows a 400 Bad Request but the client show a 405 Method Not Allowed. So they are not linked.
This makes me think that the problem is in the proxy (I guess there is a proxy because werkzeug shows request from 10.0.2.2 and dalescott.net resolve in another IP).
So you should look in the browser console which network request is actually returning a 405.

The fault is perhaps browser related. I was using Chrome on current Linux Mint and on Windows for testing, and after clearing browser data on both platforms the “method not allowed” error has not re-appeared after logging in. Does this seem reasonable?

Thank you everyone for assisting. I am sorry I didn’t think of clearing browser data sooner.

Fwiw, the server is a vm hosted by VirtualBox. It has a local address of 10.0.2.15, and is forwarded to the host IP address (dalescott.net 174.0.60.222) by the VirtualBox NAT capability (still using port 8000).

Does this explain anything? Nothing?

Thanks again for your help.

Dale

Sorry, I spoke too soon. Clearing browser data only allows one web login. Logging out and then attempting to log back in produces the “method not allowed” error again. Clearing browser data again allows login again, and the cycle repeats.

@pokoli and @edbo, I am not sure what this means. trytond --version returns 6.4.0 with and without activating the venv, but running pip list without activating the venv does not list trytond or any modules.

[tryton@starlord ~/trytond]$ source env/bin/activate
(env) [tryton@starlord ~/trytond]$ env/bin/trytond --version
trytond 6.4.0
(env) [tryton@starlord ~/trytond]$ deactivate
[tryton@starlord ~/trytond]$ env/bin/trytond --version
trytond 6.4.0
[tryton@starlord ~/trytond]$ pip list
Package    Version
---------- -------
pip        20.3.4
setuptools 57.0.0
sqlite3    0.0.0
[tryton@starlord ~/trytond]$ 

Is there anything more than can be gained by continuing to troubleshoot? If not, I’ll blow away the venv and do a new install of 6.4.0.

Thanks again,
Dale

This is weird. Can you also try the desktop client? Just download, unpack and run it (<unpacked_dir>/bin/tryton if you are on Linux / BSD).
As Sao is a web client it downloads the program first and then runs it. So it seems that at the first time you get the right data but the next time it gets the wrong data from cache.

Like I said, try the desktop client first. You can also make the Tryton server a bit more verbose by using -v. Adding more v will make it even more verbose. You can then see which query is failing.

There are no obvious issues with the desktop client (I tried both Linux and Win 64bit). Fwiw, I had noticed (in the past with 6.2.x) that the web client doesn’t always request password authentication - I only enter my user name and then I’m in. I had wondered if Chrome was automatically entering a remembered password but can’t say for sure why.

I will be able to restart the trytond server with more verbosity and report more in a couple hours.

Sao stores the session to avoid ssking for password so if the session is still valid you can login without password.

Having said that, the server will ask your password when performing some actions like posting an invoice.

Hi all, today the issue seems to have resolved itself after shutting down and re-starting the server (vm), and restarting trytond with verbosity -vv.

I logged in without issue using Chrome on Win10. I then tried loging in using Chrome on Linux Mint and the “method not allowed” error appeared, but after clearing browser data I have been able to login multiple times without further issue.

Is it recommended to reboot after a series upgrade?

@pokoli, thanks for clarifying when the server asks for a password.

You just need to restart all tryton services otherwise they will be running the previous series and not the newer ones.

Completely rebooting the server is not necessary, but restarting the trytond services is a must. Also if you have any other system in between like NginX you will be hit by caching issues. That’s my experience. I have to restart uwsgi and reload NginX to clear caches.

Thanks everyone for your help. Rebooting the server has solved the problem (possibly because I had forgotten to kill and restart trytond processes before/after upgrading).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.