Skip to content
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

[10.0] Google Calendar Sync not working #17787

Closed
argorain opened this issue Jun 23, 2017 · 15 comments
Closed

[10.0] Google Calendar Sync not working #17787

argorain opened this issue Jun 23, 2017 · 15 comments
Labels
Need information the reports lacks of information

Comments

@argorain
Copy link

argorain commented Jun 23, 2017

Impacted versions: 10.0 nightly

Steps to reproduce: On fresh installation, install Calendar app, enable Google Sync, according tutorial create Google API app and use its secret and ID. When user tries to add calendar, it fails at callback after authorizing access to google calendar.

Current behavior: Internal Server Error shows up

Expected behavior: Calendar Sync

Video/Screenshot link (optional):
Log error message:

2017-06-23 08:30:16,603 611 INFO prod-odoo werkzeug: 127.0.0.1 - - [23/Jun/2017 08:30:16] "GET /google_account/authentication?state=%257B%2522s%2522:+%2522calendar%2522,+%2522d%2522:+%2522prod-odoo%2522,+%2522f%2522:+%2522https://www.foxyco.cz/web%2523view_type%253Dcalendar%2526model%253Dcalendar.event%2526menu_id%253D307%2526action%253D423%2522%257D&code=4/CusD_F_jwoOn1B9Kqsbu4_f3rF1ZSHTc_WGO7ncG-V4 HTTP/1.1" 500 -
2017-06-23 08:30:16,622 611 ERROR prod-odoo werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/service/server.py", line 250, in app
    return self.app(e, s)
  File "/usr/lib/python2.7/dist-packages/odoo/service/wsgi_server.py", line 184, in application
    return application_unproxied(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/service/wsgi_server.py", line 170, in application_unproxied
    result = handler(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 1308, in __call__
    return self.dispatch(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 1282, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 1480, in dispatch
    result = ir_http._dispatch()
  File "/usr/lib/python2.7/dist-packages/odoo/addons/web_editor/models/ir_http.py", line 21, in _dispatch
    return super(IrHttp, cls)._dispatch()
  File "/usr/lib/python2.7/dist-packages/odoo/addons/base/ir/ir_http.py", line 199, in _dispatch
    return cls._handle_exception(e)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/base/ir/ir_http.py", line 169, in _handle_exception
    return request._handle_exception(exception)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 768, in _handle_exception
    return super(HttpRequest, self)._handle_exception(exception)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/base/ir/ir_http.py", line 195, in _dispatch
    result = request.dispatch()
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 827, in dispatch
    r = self._call_function(**self.params)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 333, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 101, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 326, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 935, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 506, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/google_account/controllers/main.py", line 16, in oauth2callback
    state = json.loads(kw['state'])
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Page visible to user:
snimek z 2017-06-23 10-36-24

@Yenthe666
Copy link
Collaborator

@JKE-be this is probably for you.
@argorain I do encourage you to add more information / feedback if you have it though.

@JKE-be
Copy link
Contributor

JKE-be commented Jun 26, 2017

Hello,

Google should redirect on this controller with a params "state" in GET.
Could you please retry and share your config if it doesn't work.

Best regards

@Yenthe666 Yenthe666 added the Need information the reports lacks of information label Jun 26, 2017
@JKE-be
Copy link
Contributor

JKE-be commented Jun 26, 2017

I have just tested on a runbot and it works as expected:

http://240304-10-0-afba38-all.runbot11.odoo.com/google_account/authentication?state=%7B"s":+"calendar",+"d":+"240304-10-0-afba38-all",+"f":+"http://240304-10-0-afba38-all.runbot11.odoo.com/web?%23view_type%3Dcalendar%26model%3Dcalendar.event%26menu_id%3D305%26action%3D401"%7D&code=xxxxxxxxxxx#

@JKE-be JKE-be closed this as completed Jun 26, 2017
@argorain
Copy link
Author

Hello.
I'll test it tonight again. Maybe I have Google app wrong, because included HowTo included is not up-to-date...
I'll let you know.
Thanks.

@JKE-be
Copy link
Contributor

JKE-be commented Jun 26, 2017

Google change their Ux once by month...

To have the most recent tuto, you can follow this one: https://www.odoo.com/documentation/user/11.0/crm/calendar/google_calendar_credentials.html

Now with externalize the tuto to be able to update it.

Best regards

@argorain
Copy link
Author

Hello.
It took me longer than I expected, but I tested it now.
I made new Google App according most recent tutorial but it is not working (still same error). Weird part is when I fill in https://.... in Google App, it complains it not match (error 400) but server is secured with certificate.
I have no idea what try next.
Thanks.

@argorain
Copy link
Author

argorain commented Jul 1, 2017

Hello.
I was poking around today and still no solution found.
My config (/etc/odoo/odoo.conf) is this:

[options]
addons_path = /usr/lib/python2.7/dist-packages/odoo/addons
admin_passwd = ***********
csv_internal_sep = ,
data_dir = /var/lib/odoo/.local/share/Odoo
db_host = False
db_maxconn = 64
db_name = False
db_password = False
db_port = False
db_template = template1
db_user = odoo
dbfilter = .*
demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLiteCity.dat
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
limit_time_real_cron = -1
list_db = True
log_db = False
log_db_level = warning
log_handler = :INFO
log_level = info
logfile = /var/log/odoo/odoo-server.log
logrotate = False
longpolling_port = 8072
max_cron_threads = 2
osv_memory_age_limit = 1.0
osv_memory_count_limit = False
pg_path = None
pidfile = None
proxy_mode = False
reportgz = False
server_wide_modules = web,web_kanban
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
syslog = False
test_commit = False
test_enable = False
test_file = False
test_report_directory = False
translate_modules = ['all']
unaccent = False
without_demo = False
workers = 0
xmlrpc = True
xmlrpc_interface = 127.0.0.1
xmlrpc_port = 8069

If there is something else, please tell me where.
I have proxy made by apache for redirection to SSL and correct subdomain.

<VirtualHost *:80>
        ServerAdmin rain@localhost
        ServerName erp.foxyco.cz
        DirectoryIndex index.html
        ErrorLog /var/log/apache2/html-error.log
        RewriteEngine on
        RewriteCond %{HTTPS} off
        RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,L]
</VirtualHost>
<VirtualHost *:443>
        SSLEngine On
        SSLProxyEngine On
        ProxyRequests Off
        ProxyPreserveHost On
        SSLProtocol all -SSLv3 -SSLv2
        SSLCertificateFile /*******/cert_CN-erp.foxyco.cz.txt
        SSLCertificateKeyFile /*****/CN-erp.foxyco.cz.pem
        SSLCACertificateFile /******/cert_ca.txt
        ProxyHTMLInterp On
        ProxyHTMLExtended On
        ProxyHTMLURLMap (.*)127.0.0.1:8069(.*) https:/erp.foxyco.cz$2 [Rin]
        ProxyPass / http://127.0.0.1:8069/
        ProxyPassReverse / http://127.0.0.1:8069/
        ServerName erp.foxyco.cz
</VirtualHost>

I tried variations in OAuth with http, https even with :8069 specified. No luck.
By the way, tutorial you posted (https://www.odoo.com/documentation/user/11.0/crm/calendar/google_calendar_credentials.html) contains error. In tutorial is callback address .../google_account/authentification but odoo uses .../google_account/authentication. Rest is ok.
Thanks for support.
Vojtech

@JKE-be
Copy link
Contributor

JKE-be commented Jul 1, 2017

Have you try on runbot with the same google configuration that it Works?

@argorain
Copy link
Author

argorain commented Jul 1, 2017

No. How can I do that?

@JKE-be
Copy link
Contributor

JKE-be commented Jul 1, 2017

Connect to runbot.odoo.com and take the last v10: http://241746-10-0-web-editor-opw-746776-nle-2955bf.runbot5.odoo.com/en_US/?db=241769-10-0-2955bf-all

Connect in admin / admin

Configurer and test on it ...

@argorain
Copy link
Author

argorain commented Jul 1, 2017

It works on runbot as it should. I am wondering what is wrong with my setup. I have feeling that ProxyPass is making some mess in there...
Is there way how to debug it? Maybe printout of received json?
Thanks for support, at least I can remove one of suspects now.
Vojtech

@JKE-be
Copy link
Contributor

JKE-be commented Jul 1, 2017

yo can try to print, but according to the previous traceback, you have no params passed the the callback.. what is strange...
You should enable debugger chrome and 'preserve log' ang check what is happening between google redirect and the web client ...

@argorain
Copy link
Author

argorain commented Jul 1, 2017

I see. I'll give it a try tomorrow. Thanks.

@argorain
Copy link
Author

argorain commented Jul 2, 2017

Hello.
I found solution. There was problem with HTTP->HTTPS redirection. It changed in RewriteRule address from
http://erp.foxyco.cz/google_account/authentication?state={"s":+"calendar",+"d":+"prod-odoo",+"f":+"https://erp.foxyco.cz/web%23view_type%3Dcalendar%26model%3Dcalendar.event%26action%3D433"}&code=4/gP7BtRPyc_55ZESnSGtKz2EmnJlWLbgPl316sR9S9ds#
to
https://erp.foxyco.cz/google_account/authentication?state=%7B%22s%22:+%22calendar%22,+%22d%22:+%22prod-odoo%22,+%22f%22:+%22https://erp.foxyco.cz/web%23view_type%3Dcalendar%26model%3Dcalendar.event%26action%3D433%22%7D&code=4/T7jiUxR3k89aXqz0TAD6UHyYe5zF-iq8N5ViZXT0Hbo#
so Odoo parser can't parse it.
It was fixed by adding parameter NE to RewriteRule, so now it keep original format. Resulting RewriteRule looks this way:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R=301,NE,L]

Thanks a lot for support, pointing me to missing params in callback was needed point for resolution.
Thanks.
Vojtech Vladyka

@JKE-be
Copy link
Contributor

JKE-be commented Jul 2, 2017

Glad to hear it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Need information the reports lacks of information
Projects
None yet
Development

No branches or pull requests

4 participants
@JKE-be @Yenthe666 @argorain and others