MerginMaps / MerginMaps/qgis-plugin

Crash when creating project or clone project during maitenance mode

Open
#584 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 the server is in maintenance mode and I hit to create a project (+button), the plugin crash

An error has occurred while executing Python code: 

Mergin.mergin.common.ClientError: HTTP Error: 503 Service Unavailable URL: https://app.dev.merginmaps.com/v1/user/profile Method: GET Detail: { "status" : "503", "title" : "Service unavailable", "detail" : "The site is undergoing scheduled maintenance." } 
Traceback (most recent call last):
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/ws/python/plugins/Mergin/mergin/client.py", line 206, in _do_request
    return self.opener.open(request)
  File "/usr/lib/python3.10/urllib/request.py", line 525, in open
    response = meth(req, response)
  File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.10/urllib/request.py", line 563, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/ws/python/plugins/Mergin/plugin.py", line 440, in create_new_project
    user_info = self.mc.user_info()
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/ws/python/plugins/Mergin/mergin/client.py", line 757, in user_info
    resp = self.get("/v1/user/profile")
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/ws/python/plugins/Mergin/mergin/client.py", line 230, in get
    return self._do_request(request)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/ws/python/plugins/Mergin/mergin/client.py", line 195, in wrapper
    return f(self, *args)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/ws/python/plugins/Mergin/mergin/client.py", line 220, in _do_request
    raise ClientError(error_msg)
Mergin.mergin.common.ClientError: HTTP Error: 503 Service Unavailable
URL: https://app.dev.merginmaps.com/v1/user/profile
Method: GET
Detail: { "status" : "503", "title" : "Service unavailable", "detail" : "The site is undergoing scheduled maintenance." }


Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] 
QGIS version: 3.34.7-Prizren Prizren, 6f7d735cae3 

Python Path:
/usr/share/qgis/python
/home/jozef/.local/share/QGIS/QGIS3/profiles/ws/python
/home/jozef/.local/share/QGIS/QGIS3/profiles/ws/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/home/jozef/.local/lib/python3.10/site-packages
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
/home/jozef/.local/share/QGIS/QGIS3/profiles/ws/python
.
/home/jozef/Lutra/projects/a/a6

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 with create_new_project in plugin.py and trace the user_info call through client.py, especially the GET request and ClientError shown in the report. Reproduce the create or clone project action while maintenance mode returns HTTP 503. Done means the plugin does not crash in this situation and handles the maintenance response appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.