inveniosoftware / invenio-app-rdm

Turn-key research data management platform.
https://inveniordm.docs.cern.ch
MIT License
108 stars 148 forks source link

REST API: Community Deletion Error for Non-Existing Community 500 Internal Server Error #2699

Open Samk13 opened 4 months ago

Samk13 commented 4 months ago

Package version (if known): 12.0.0rc2 and Zenodo

Describe the bug

When attempting to delete a non-existing community via the API, a 500 Internal Server Error is returned.

Steps to Reproduce

  1. Go to Zenodo
  2. DELETE {{baseURL}}/api/communities/4296649f-e634-419e-87d0-eb0099714d5b
  3. See error

Expected behavior

A 404 Not Found error should be returned when attempting to delete a non-existing community.

Screenshots (if applicable)

{
    "error_id": "7c8dd34f215a4eefa20a7f15bb78deb9",
    "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.",
    "status": 500
}

Additional context

response log ```log Traceback (most recent call last): File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask/app.py", line 2552, in __call__ return self.wsgi_app(environ, start_response) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/werkzeug/middleware/proxy_fix.py", line 187, in __call__ return self.app(environ, start_response) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/werkzeug/middleware/dispatcher.py", line 78, in __call__ return app(environ, start_response) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask/app.py", line 2552, in __call__ return self.wsgi_app(environ, start_response) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/werkzeug/middleware/proxy_fix.py", line 187, in __call__ return self.app(environ, start_response) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask/app.py", line 2532, in wsgi_app response = self.handle_exception(e) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask/app.py", line 2529, in wsgi_app response = self.full_dispatch_request() File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask/app.py", line 1825, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request rv = self.dispatch_request() File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask_resources/resources.py", line 65, in view return view_meth() File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask_resources/content_negotiation.py", line 116, in inner_content_negotiation return f(*args, **kwargs) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask_resources/parsers/decorators.py", line 51, in inner return f(self, *args, **kwargs) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask_resources/parsers/decorators.py", line 51, in inner return f(self, *args, **kwargs) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/flask_resources/parsers/decorators.py", line 90, in inner return f(self, *args, **kwargs) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/invenio_communities/communities/resources/resource.py", line 148, in delete self.service.delete_community( File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/invenio_records_resources/services/uow.py", line 376, in inner res = f(self, *args, **kwargs) File "/home/samk13/.pyenv/versions/3.9.19/envs/test-install/lib/python3.9/site-packages/invenio_communities/communities/services/service.py", line 468, in delete_community raise DeletionStatusError(record, CommunityDeletionStatusEnum.PUBLISHED) invenio_communities.errors.DeletionStatusError: ({'files': {'enabled': True}, 'access': {'visibility': 'public', 'member_policy': 'open', 'record_policy': 'open', 'review_policy': 'closed', 'members_visibility': 'public'}, '$schema': 'local://communities/communities-v1.0.0.json', 'metadata': {'page': 'Corporate', 'type': {'id': 'event'}, 'title': 'public-community-Gorgeous-generate', 'website': 'https://kth.se/', 'description': 'object-oriented', 'organizations': [{'name': 'KTH'}], 'curation_policy': 'This is the kind of records we accept.'}, 'tombstone': {'note': '', 'is_visible': True, 'removed_by': {'user': '2'}, 'removal_date': '2024-06-10T15:59:30.236299', 'citation_text': ''}, 'custom_fields': {}}, ) ```
github-actions[bot] commented 2 months ago

This issue was automatically marked as stale.