Closed dtrckd closed 5 years ago
I noticed the HTTP/2 response in your issue report. I fixed the code in the commit https://github.com/itchyny/calendar.vim/commit/3e15f2af03ee0f815df40f8597060ae449a3c751. Thank you for your detailed report. Close after you confirm the issue does not happen again.
It works now ! Thanks for your efficiency. Have a nice day.
Hello,
I got again the exactly same issue. Except that this time, the log in .cache/vim.calendar/download/ are empty.
The only way I can use the calendar to save or delete task is by removing all the cache and settings again the credentials in google calendar?=.
Do you known what can cause this ?
Please recheck the logs, :Calendar -debug
should save the log under ~/.cache/calendar.vim/download
or g:calendar_cache_directory
if you have configuration in vimrc.
The logs are empty in my case :/ . (the file name is like download/google_calendar_insert_xxxx...)
Hi, I precise that the empty logs occur for all actions. Thus the filenames of logs created after interactions with the calendar are empty (in the debug mode):
Would it be another way to find out what's going on ?
(it seems that I can only interact with the google calendar only during the first session of vim.calendar after deleting the cache and accepting a new credentials from google...)
Can you debug some variables with the following patch? :messages
will output the variable values (be careful with the credentials)
diff --git a/autoload/calendar/webapi.vim b/autoload/calendar/webapi.vim
index 9d069d3..edac236 100644
--- a/autoload/calendar/webapi.vim
+++ b/autoload/calendar/webapi.vim
@@ -119,6 +119,7 @@ function! s:request(json, async, url, param, postdata, method) abort
endif
endif
let command = s:command(url, a:method, header, postfile, a:async == {} ? '' : s:cache.path(a:async.id))
+ echom command
if type(command) != type('')
return { 'status': '0', 'message': '', 'header': '', 'content': '' }
endif
@@ -126,6 +127,7 @@ function! s:request(json, async, url, param, postdata, method) abort
if a:async == {}
let data = calendar#util#system(command)
let response = calendar#webapi#parse(split(data, "\n"))
+ echom string(response)
if withbody
call delete(postfile)
endif
@@ -187,6 +189,7 @@ function! calendar#webapi#callback(id, cb) abort
return 1
endif
let response = calendar#webapi#parse(data)
+ echom string(response)
if empty(response)
return 1
elseif a:cb !=# ''
Ok thanks.
Apparently, only the message of the first echom appears. And the result is the following :
['wget -O- --save-headers --server-response -q --header="Content-Type: application/json" --header="X-HTTP-Method-Override: POST" --header="Content-Length: 141" --post-file="/tmp/vYeuNeT/6" -O "/home/dtrckd/.cache/calendar.vim/download/google_calendar_insert_201810231240040001" "https://www.googleapis.com/calendar/v3/calendars/XXXX%40gmail.com/events?calendarId=XXXX%40gmail.com&oauth_token=xxxxxxxxxx'](url)
That command can be executed in shell and should exit successfully.
That's true. (still the created file is empty, which may be normal?). However, I reset my credential again to re-try. I can add tasks for now (I am not sure when it starts to fail adding task), therefore I cannot delete tasks. I have the prompt y/N to confirm deletion, but then nothing happen...
Thank you for your patient debugging, I finally found that the implementation was incomplete for wget command (I think it assumes curl command availability). It should be fixed for now so please update the plugin. Dealing non-GET method and non-2xx response in wget is a kind of pain.
Excellent, I confirm the deletion works fine now and the debug mode too. Thank you very much.
Hi,
I got the strange following issue: After authorizing calendar.vim to access the appli, I can succesfully read and add events to the remote calendar. But after a while, when I launch calendar.vim again, I can no more modify the remote calendar and I got the following error with :Calendar -debug
(Note that I tried to remove cache info, add new CODE: etc, and calendar.vim was Vundle updated)
HTTP/2.0 401^M vary:X-Origin^M vary:Origin,Accept-Encoding^M www-authenticate:Bearer realm="https://accounts.google.com/", error=invalid_token^M content-type:application/json; charset=UTF-8^M cache-control:private, max-age=0^M x-content-type-options:nosniff^M x-frame-options:SAMEORIGIN^M x-xss-protection:1; mode=block^M server:GSE^M alternate-protocol:443:quic^M accept-ranges:none^M ^M { "error": { "errors": [ { "domain": "global", "reason": "authError", "message": "Invalid Credentials", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Invalid Credentials" } }
Any idea of what can cause this trouble ?