-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in Odoo 16 [KeyError: 'socket'] #106339
Comments
This could be because you have set proxy_mode = True in your odoo config file but you're not using a reverse proxy. |
I see the same error, no docker, just fresh odoo 16 run locally. Full Traceback:
|
I have the same error. Did you know how to fix it ? Thank in advance. |
@Yenthe666 |
Check your Nginx config file.
This solved the problem for me |
Thanks @zuher83, worked for me too. |
We are running Odoo behind a traefik reverse proxy. Traefik is a great improvement over nginx for us because it allows dynamic/ container-driven routing. Switching to Nginx is no option for us. We get this error with our Odoo 16 containers, although we already did the following steps:
Still, we get this error. Does anyone here have an idea how to fix this issue with Traefik reverse proxy? |
I get this error without any reverse proxy. |
This is normal, I advise you to work a proxy reverse and configure it well (eg: Nginx ...). Also configure your hosts file in Windows 11 to target the right local domain. You must also configure your network when you launch your WSL... |
Have you solved the issue? @markuskirch |
@oliverzgy no, unfortunately not. Odoo Enterprise support couldn't really help us. The problem seems to be that not all headers are forwarded correctly by treafik in the default configuration. Odoo support couldn't really tell us which headers and header values are expected specifically, which makes troubleshooting rather difficult. I suspect that the problem might be related to the https entrypoint, because websockets might use the ws protocol (or wss after an ssl handshake) (again: no official info which proto is used by Odoo websockets), and traefik sets the X-Forwarded-Proto value to https. In addition to the Proto, there might also be a problem with the Upgrade/Connection header. The ws/wss middleware could forward this header or set header key/value pairs manually, but again we lack information on which key and value is expected by Odoo. Looking forward to hearing if you can make any progress with this issue. |
We had similar issues. In Odoo 16 the path |
the following config worked for me upstream odoo-get { upstream odoolp-get { server { location / { location /websocket {
} server { where common proxy is and common params is this is for an odoo running with workers 3 and proxy mode True |
upon revision those lines are not necesary |
The problem with the NGINX |
I got same error using Traefik. In my case the problem was Ubuntu Server, I had to migrate the server to Debian 11 and now this problem in particular with others problem that I got during the use of Odoo 16 have been solved. |
I have the same problem, and when I don't specify any workers in the config, I get a lot of "connection lost. trying to reconnect" |
Do you get some solution I have this problem now |
We had the same issue with traefik, but I think I could solve it. I have this configuration in odoo.conf:
Setting My traefik configuration in docker-compose:
Now it looks like it was working for us. Maybe there is smth that can help you too? Version:
|
I have this solution and its work now, odoo 16 change correctly to websocket communication: |
I hope work for all guys. |
Great, thanks for sharing your solution! |
this one worked for me, i have installed odoo16 in a docker behind nginx, i have been searching for days and found the only thing is how you handle proxy pass and back requests via nginx. i have multiple odoo installation so this one had odoo on 8081 and live chat/websocket on port 20025, you may replace it with 8069 and 8072 respectivly. replace xyz with your domain name. here is my working configuration. Odoo serversupstream odoo { upstream odoochat { server { proxy_read_timeout 720s; Proxy headersproxy_set_header X-Forwarded-Host $host; log filesaccess_log /var/log/nginx/erp.xyz.com.access.log; Handle longpoll requestslocation /websocket { Handle / requestslocation / { } Gzipgzip_types text/css text/less text/plain text/xml application/xml application/json application/ja$ client_body_in_file_only clean;
} server { server_name erp.xyz.com; } |
Thank you @imhassanawais , your solution worked for me. I personally use docker for my odoo deployments behind nginx + nginx-letsencrypt + nginx-gen (automatic nginx configuration for new containers + automatic SSL certificates generation). For others using the same setup as mine, you may find the following instructions useful. NGINX vhost files for odooAdd this in your vhost file in nginx vhost conf folder (the file should have the same name as the domain you are using, example DOMAIN)
NGINX vhost location configurationAdd this in your vhost file location in nginx vhost conf folder, the filename should be DOMAIN_location
ODOO configuration fileMake sure you enabled these parameters in your odoo.conf file, of course you can change the workers count.
|
I am also having this issue on multiple servers Ubuntu/nginx/Odoo 16. I am getting I am using proxy_mode = True and this is from nginx conf: Anybody seeing something missing here? |
Did you update your dependencies via pip or apt? |
We improved the error reporting here #137972 hopefully this will help you understanding what's going on |
I did install fresh from the GitHub repo and ran pip install -r requirements.txt. As I understood the versions there are pinned. Also there is nothing upgradable in the Ubuntu. Main reason why I am hunting this websockets bug is because I do not have "Tap to Scan" functionality in the Attendances Kiosk Mode. Only "Scan your badge" barcode icon is there. But no "Tap to Scan" overlay with the red line. In the Network tab on that page I see that websocket_worker_bundle?v=1.0.5 is always pending, it was not ever loaded and the size loaded is 0B. I presume this is wrong? |
Hello @bnisevic , regarding the missing feature "Tap to scan", the barcode scanner feature was an enterprise module until version 16.2 unfortunately, so it won't be available in your community version. |
Thanks guys for the help and explanations! The picture is much clearer now. I hope this thread will help other people with similar problem. @Julien00859 gave a really nice explanation. For sure these requests (directly to Odoo web server) were made from kiosk mode. This is where I got errors. IMHO there should be somewhere in the documentation noted If reverse proxy is used then xmlrpc_interface should be set to the local address and not listening everywhere. This is clear to me now. But from the docs it was not clear. Odoo site is under maintenance right now, I can not access so I am putting the link blindly, I think reverse proxy conf is shown somewhere here https://www.odoo.com/documentation/16.0/administration/install.html Now, how can I upgrade to 16.2? 😏 |
I can confirm that this also worked for me. I am running Odoo as a TrueNAS App, the app itself is created/maintained by TrueCharts. Since the Traefik app in TrueCharts does not (yet) support all the required middleware types/settings, I had to apply these manually using |
I'm having this issue. But this doesn't fix it. I use CloudFlare which seems to be possibly the issue. Any ideas? |
Did you set xmlrpc_interface in the odoo conf? |
Yes I set that. I've tried absolutely everything. Spent many hours now trying to get this to work. :-( |
You should checkout the console in your browser and see on which address are you getting the key error. |
Bad Request In the logs it says 400 Bad Request: Empty or missing header(s). |
This does not sound as the same KeyError issue mentioned above. But it sounds like a problem with the Cloudflare. |
Thanks for this. I was able to make live chat work. It is VERY IMPORTANT to observe the ORDER of the rule below: Path( So the path has to come first. Otherwise it simply doesn't function. In my case, I had to configure with www and without www so mine looks like this: Path( Previous it was like this: Host( So again, PATH HAS TO COME BEFORE HOST. I did not know that Traefik v2 cared about the order. Now I do. Thanks for the above solution! |
Question: our QA server is running without NginX reverse proxy and we are getting the "KeyError: 'socket'" error. If my understanding of this thread is correct, the error is caused by a reverse proxy/ odoo misconfiguration, how do we resolve this issue if we are not using a reverse proxy? Why are these errors occurring if there is no reverse proxy? Thanks in advance!! Running on (stock standard) Ubuntu 20.04 Config: |
Are you forwarding websockets to 8072? |
Need add ` in url
After that, the internal error about the socket in docker disappeared |
I've concatenated every snipper for traefik from this thread, and I'm not having the KeyError error, but rather a 404 error on /websockets, answered by worker "longpolling". Anyone had the same ?
|
in odoo.conf? |
@pomazanbohdan yup, that's the odoo.conf :
|
if you use docker-compose add this soluction in your labels in compose #106339 (comment) |
Not working in my case
NGINX configuration
Is any configuration missing here? |
We are closing this issue because the root cause of the Using the feedback from this issue, we tried to improve the official documentation regarding the system configuration. The builtin server section have been entirely reworded with up-to-date termonology. The HTTPS section has been updated with websocket sample configuration for nginx (don't forget the Can I use Odoo without a reverse proxy?This address a question from @xra-devops. No, the internal Odoo web server is not suited to face the internet. We are using the same technology as flask does: werkzeug, a a library that offers many http-related utilities including a light web server that is:
While we tweaked that server to offers efficiency and stability, we didn't wasted our time securing it because that's actually the job of the web server to filter and sanitize incoming requests. Running the Odoo web server in front of the internet makes you vulnerable to numerous threats, DOS attacks on top of them. We recommend nginx because that's the web server we know best. Can I use Odoo without the
|
Impacted versions: Odoo 16 Docker
Steps to reproduce:
I get the error when I install Odoo 16 via docker
File "/usr/lib/python3/dist-packages/odoo/addons/bus/controllers/websocket.py", line 23, in websocket
return WebsocketConnectionHandler.open_connection(request)
File "/usr/lib/python3/dist-packages/odoo/addons/bus/websocket.py", line 807, in open_connection
Websocket(request.httprequest.environ['socket'], request.session),
KeyError: 'socket'
The text was updated successfully, but these errors were encountered: