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

Error: Project could not be queried. #32

Open
ihasdapie opened this issue Jul 21, 2021 · 21 comments
Open

Error: Project could not be queried. #32

ihasdapie opened this issue Jul 21, 2021 · 21 comments

Comments

@ihasdapie
Copy link

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

@rayvburn
Copy link

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

ols login

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

@moritzgloeckl
Copy link
Owner

@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
Copy link
Owner

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

@srydstedt
Copy link

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.

@moritzgloeckl
Copy link
Owner

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

@moritzgloeckl moritzgloeckl reopened this Nov 20, 2022
@srydstedt
Copy link

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.

@Tadelsucht
Copy link

Tadelsucht commented Nov 21, 2022

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

@srydstedt
Copy link

@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" ?

@Tadelsucht
Copy link

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. 🤷‍♂️

@srydstedt
Copy link

srydstedt commented Nov 23, 2022 via email

@ji-cerny
Copy link

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.

@wongsingfo
Copy link

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         )

@srydstedt
Copy link

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

@itstorque
Copy link

itstorque commented Nov 26, 2022

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

@itstorque
Copy link

@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.

@Tadelsucht
Copy link

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!

@srydstedt
Copy link

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
Copy link

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
Copy link

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.

@Parsa2820
Copy link

Parsa2820 commented Feb 27, 2023

@itstorque
Where should I put the copied GCLB value?

@thohemp
Copy link

thohemp commented Feb 27, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants