overleaf-sync icon indicating copy to clipboard operation
overleaf-sync copied to clipboard

`Error: Project could not be queried.`

Open ihasdapie opened this issue 4 years ago • 21 comments

I've been getting this error recently with overleaf-sync 1.1.5, possibly overleaf has changed up their site a bit?

I suggest that instead of querying for the project every time, we can give the option to manually specify or cache the overleaf project id; this would help avoid project querying failures

ihasdapie avatar Jul 21 '21 19:07 ihasdapie

@ihasdapie, I've just had the same error. Try to re-run

ols login

and overwrite your cookie file. This helped in my case.

rayvburn avatar Jul 28 '21 13:07 rayvburn

@ihasdapie If this happens please re-run the command you ran with verbose option -v so it outputs the stack trace and I can test and check what was going on. For now I suppose this issue is resolved? Thanks.

moritzgloeckl avatar Oct 02 '21 13:10 moritzgloeckl

Closing this for now - feel free to re-open if this occurs again or when you can provide stack traces. Thanks!

moritzgloeckl avatar Oct 17 '21 09:10 moritzgloeckl

Hi,

I am getting the same error now, I ran it with the -v option and get this.

(overleaf) C:\Users\simon\Desktop\HT22\Master's Thesis Econometrics HT22 (Copy)>ols -v Project queried successfully. ✅ Querying project ⠋ Querying project detailsTraceback (most recent call last): File "C:\Users\simon\miniconda3\envs\overleaf\lib\site-packages\olsync\olsync.py", line 348, in execute_action success = action() File "C:\Users\simon\miniconda3\envs\overleaf\lib\site-packages\olsync\olsync.py", line 73, in lambda: overleaf_client.get_project_infos(project["id"]), File "C:\Users\simon\miniconda3\envs\overleaf\lib\site-packages\olsync\olclient.py", line 167, in get_project_infos self._cookie["GCLB"], KeyError: 'GCLB'

💥 Querying project details Error: Project details could not be queried.

srydstedt avatar Nov 20 '22 08:11 srydstedt

Ok I see, could you please delete the .olauth file, log in again and then try again? Thanks!

moritzgloeckl avatar Nov 20 '22 11:11 moritzgloeckl

I have tried to do that now, the same thing happens. I tried it before too but by logging in again and overwriting .olauth. I also tried making a new environment and installing there to not have any disturbances with anything.

I am running Python 3.9.13 and installing with pip3.

srydstedt avatar Nov 20 '22 11:11 srydstedt

I changed for "debugging" in olbrowserlogin.py the code to this:

    def handle_cookie_added(self, cookie):
        print("cookie_name:")
        cookie_name = cookie.name().data().decode('utf-8')
        print(cookie_name)
        print("COOKIE_NAMES:")
        print(COOKIE_NAMES)
        if cookie_name in COOKIE_NAMES:
            print("cookie.value:")
            print(cookie.value().data().decode('utf-8'))
            self._cookies[cookie_name] = cookie.value().data().decode('utf-8')

ols -login -v will then result in the following output (without SECRET):

⠼ Logincookie_name:
overleaf_session2
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
cookie.value:
s%3Ai_xIFLVaU2FvdnSKhB4hEGx9MQm1hAYv.ZP0F6xooMMhuH9ZBqEyXD8F6vLgoHVNPXM3Rmr14pT4
⠹ Logincookie_name:
overleaf_session2
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
cookie.value:
s%3Ai_SECRET_SECRET_SECRET_SECRET
cookie_name:
overleaf_session2
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
cookie.value:
s%3Ai_SECRET_SECRET_SECRET_SECRET
⠏ Logincookie_name:
_GRECAPTCHA
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
⠴ Logincookie_name:
_GRECAPTCHA
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
⠧ Logincookie_name:
deviceHistory
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
cookie_name:
overleaf_session2
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
cookie.value:
s%3A-SECRET_SECRET_SECRET_SECRET
⠋ Logincookie_name:
overleaf_session2
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
cookie.value:
s%3A-SECRET_SECRET_SECRET_SECRET
⠴ Logincookie_name:
overleaf_session2
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
cookie.value:
s%3A-SECRET_SECRET_SECRET_SECRET
cookie_name:
overleaf_session2
COOKIE_NAMES:
['overleaf_session2', 'GCLB']
cookie.value:
s%3A-SECRET_SECRET_SECRET_SECRET
Login successful. Cookie persisted as `.olauth`. You may now sync your project.
✅  Login

It seems, that handle_cookie_added is never been called with the GCLB cookie.

Could it be a problem with the language subdomain ("https://www.overleaf.com/project" vs "https://de.overleaf.com/project" )? In chrome dev tools in Application->Cookies I have a GCLB cookie for de.overleaf.com but not for www.overleaf.com. image

image

Tadelsucht avatar Nov 21 '22 15:11 Tadelsucht

@Tadelsucht That is an interesting observation. Does it work for you? Is there a way for me to try to sync via "https://de.overleaf.com/project" ?

srydstedt avatar Nov 23 '22 14:11 srydstedt

No, overleaf-sync does not work for me. Changing the URLs in the python script to the language specifc one does not help either. The python script does not get the needed GCLB cookie. 🤷‍♂️

Tadelsucht avatar Nov 23 '22 15:11 Tadelsucht

Hm, okay. It is strange that not more people seem to have this problem 🧐

On 23 Nov 2022, at 16:05, Julien Bartels @.***> wrote:



No, overleaf-sync does not work for me. Changing the URLs in the python script to the language specifc one does not help either. The python script does not get the needed GCLB cookie. 🤷‍♂️

— Reply to this email directly, view it on GitHubhttps://github.com/moritzgloeckl/overleaf-sync/issues/32#issuecomment-1325219407, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4EUNJEPMFICRIBZDHM2VX3WJYXENANCNFSM5AYTTL3Q. You are receiving this because you commented.Message ID: @.***>

srydstedt avatar Nov 23 '22 15:11 srydstedt

I just installed overleaf-sync via pip and have exactly the same problem. (I tried to delete .olauth etc, but it does not help)

$ ols -v 
Project queried successfully.
✅  Querying project
⠋ Querying project detailsTraceback (most recent call last):
  File "/home/xxx/.local/lib/python3.11/site-packages/olsync/olsync.py", line 348, in execute_action
    success = action()
              ^^^^^^^^
  File "/home/xxx/.local/lib/python3.11/site-packages/olsync/olsync.py", line 73, in <lambda>
    lambda: overleaf_client.get_project_infos(project["id"]),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.local/lib/python3.11/site-packages/olsync/olclient.py", line 167, in get_project_infos
    self._cookie["GCLB"],
    ~~~~~~~~~~~~^^^^^^^^
KeyError: 'GCLB'

💥  Querying project details
Error: Project details could not be queried.

ji-cerny avatar Nov 25 '22 11:11 ji-cerny

Same issue.

I have a GCLB cookie for www.overleaf.com but not for overleaf.com.

I replace self._cookie["GCLB"] with the cookie value copied from chrome and ols works.

# olclient.py
  165         cookie = "GCLB={}; overleaf_session2={}" \
  166             .format(
  167             "xxxxxxxxxxxx",  # use the value copied from chrome
  168             # self._cookie["GCLB"],
  169             self._cookie["overleaf_session2"]  Object of type "None" is not subscriptable
  170         )

wongsingfo avatar Nov 26 '22 13:11 wongsingfo

@wongsingfo Could you explain what value it is that you are coping from Chrome and how to find it?

srydstedt avatar Nov 26 '22 15:11 srydstedt

Can confirm what @wongsingfo and if you open a project (I opened the target project) in the QT window (commented out the QCoreApplication.quit() line and clicked it myself, printing out cookies with domain overleaf printed out the GCLB cookie. Seems like a fix for this might be open any project after reaching the project page before quitting the QT window. See https://github.com/itstorque/overleaf-sync/commit/802530064f7747004a4daee149d2083c464cf8ca

itstorque avatar Nov 26 '22 19:11 itstorque

@srydstedt if you want to do it manually, inspect element in chrome. Go to the application tab, on the left menu bar there is cookies under the storage section. If you click on the overleaf url, you see all cookies attributed to overleaf, one of which is the GCLB cookie which you can copy the value of.

itstorque avatar Nov 26 '22 20:11 itstorque

Can confirm what @wongsingfo and if you open a project (I opened the target project) in the QT window (commented out the QCoreApplication.quit() line and clicked it myself, printing out cookies with domain overleaf printed out the GCLB cookie. Seems like a fix for this might be open any project after reaching the project page before quitting the QT window. See itstorque@8025300

It now works again for me with your changes :) Thanks!

Tadelsucht avatar Nov 27 '22 06:11 Tadelsucht

Seems promising that it works for you guys, thanks for providing a solution!

I am very new to all this, I've been trying to edit the code by myself for a while now but can't figure it out. So far I have done this, since apparently it was not good practise to try to edit the package where it's originally installed. pip3 install -e git+https://github.com/moritzgloeckl/overleaf-sync.git#egg=overleaf-sync Now I am searching (via the File Explorer) through the location where this package was installed, but I can't find the files where the source code is, for example "olclient.py". How can I do this?

srydstedt avatar Nov 27 '22 07:11 srydstedt

I have figured out how to find the files and edit them now. But the sync still doesn't work for me. @Tadelsucht I tried your changes according to your fix and the login and list is working but not the sync.

srydstedt avatar Nov 27 '22 11:11 srydstedt

I reinstalled everything and now it works! What I did different was to install in a folder with a identical name as my project, don't know if it mattered or not.

srydstedt avatar Nov 27 '22 12:11 srydstedt

@itstorque Where should I put the copied GCLB value?

Parsa2820 avatar Feb 27 '23 07:02 Parsa2820

I have a similar error:

⠼ Querying all projectsTraceback (most recent call last):
  File "/home/thorsten/.local/lib/python3.9/site-packages/olsync/olsync.py", line 348, in execute_action
    success = action()
  File "/home/thorsten/.local/lib/python3.9/site-packages/olsync/olsync.py", line 142, in query_projects
    for index, p in enumerate(sorted(overleaf_client.all_projects(), key=lambda x: x['lastUpdated'], reverse=True)):
  File "/home/thorsten/.local/lib/python3.9/site-packages/olsync/olclient.py", line 92, in all_projects
    BeautifulSoup(projects_page.content, 'html.parser').find('meta', {'name': 'ol-projects'}).get('content'))
AttributeError: 'NoneType' object has no attribute 'get'

💥  Querying all projects
Error: Querying all projects failed. Please try again.

thohemp avatar Feb 27 '23 09:02 thohemp