MerginMaps / MerginMaps/qgis-plugin

Errors after user account is closed

Open
#375 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
44
Forks
20
Avg merge
3d 12h
Merged PRs (30d)
5

Description

When user account on mergin is closed, plugin shows different types of error on open project of this account:

  1. when cloning project:
An error has occurred while executing Python code: 

Mergin.mergin.common.ClientError: "Authentication information is missing or invalid." 
Traceback (most recent call last):
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 188, in _do_request
    return self.opener.open(request)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: UNAUTHORIZED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/plugin.py", line 409, in clone_remote_project
    user_info = self.mc.user_info()
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 554, in user_info
    resp = self.get('/v1/user/' + self.username())
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 203, in get
    return self._do_request(request)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 178, in wrapper
    return f(self, *args)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 193, in _do_request
    raise ClientError(e.read().decode("utf-8"))
Mergin.mergin.common.ClientError: "Authentication information is missing or invalid."



Python version: 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] 
QGIS version: 3.22.5-Białowieża Białowieża, c27231782f 

Python Path:
/usr/share/qgis/python
/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python
/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/jozef/.local/lib/python3.8/site-packages
/usr/local/lib/python3.8/dist-packages
/usr/lib/python3/dist-packages
/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python
/home/jozef/Lutra/projects/21.3.22/prj
  1. when sync changes
    Failed to get status for project tme151/prj:
<html>
  <head>
    <title>Internal Server Error</title>
  </head>
  <body>
    <h1><p>Internal Server Error</p></h1>
    
  </body>
</html>
  1. when removing project from mergin
Failed to remove project tme151/test_prj:

"Authentication information is missing or invalid."
  1. when downloading the project
Failed to download project tme151/test_prj due to an unhandled exception.
This should not happen, [please report the problem](https://github.com/lutraconsulting/qgis-mergin-plugin/issues).
Traceback (most recent call last):

  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 188, in _do_request
    return self.opener.open(request)

  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)

  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(

  File "/usr/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)

  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)

  File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)

urllib.error.HTTPError: HTTP Error 500: Internal Server Error


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/sync_dialog.py", line 99, in download_start_internal
    self.job = download_project_async(self.mergin_client, self.project_name, self.target_dir)

  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client_pull.py", line 125, in download_project_async
    latest_proj_info = mc.project_info(project_path)

  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 474, in project_info
    resp = self.get("/v1/project/{}".format(project_path), params)

  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 203, in get
    return self._do_request(request)

  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 178, in wrapper
    return f(self, *args)

  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 193, in _do_request
    raise ClientError(e.read().decode("utf-8"))

Mergin.mergin.common.ClientError: <html>
  <head>
    <title>Internal Server Error</title>
  </head>
  <body>
    <h1><p>Internal Server Error</p></h1>
    
  </body>
</html>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the request handling in mergin/client.py, then trace the reported callers in plugin.py, sync_dialog.py, and mergin/client_pull.py. Reproduce the closed-account actions and make their authentication or server failures produce consistent, actionable errors instead of raw HTML, unhandled exceptions, or differing messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.