ITISFoundation / osparc-simcore

🐼 osparc-simcore simulation framework
https://osparc.io
MIT License
46 stars 27 forks source link

🐛 Fix URL serialization in `/invitations:extract` endpoint #6808

Open giancarloromeo opened 14 hours ago

giancarloromeo commented 14 hours ago

What do these changes do?

Fix the invitation URL serialization in the request body when hitting the /invitations:extract endpoint.

Unable to process your invitation since the invitations service is currently unavailable [OEC:138117572806592].
{'context': "{'code': "
            "'ValueError.WebServerBaseError.InvitationsError.InvitationsServiceUnavailableError',
"
            " 'message': 'Cannot process invitations',
"
            " 'unexpected_error': TypeError('Object of type Url is not JSON "
            "serializable')}",
 'error_code': 'OEC:138117572806592',
 'exception_details': 'Cannot process invitations',
 'exception_type': '<class '
                   "'simcore_service_webserver.invitations.errors.InvitationsServiceUnavailableError'>",
 'tip': 'Something went wrong communicating the `invitations` service'}
Traceback (most recent call last):
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_webserver/invitations/_core.py", line 32, in _handle_exceptions_as_invitations_errors
    yield  # API function calls happen
    ^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_webserver/invitations/_core.py", line 100, in validate_invitation_url
    invitation = await invitations_service.extract_invitation(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_webserver/invitations/_client.py", line 85, in extract_invitation
    response = await self.client.post(
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/aiohttp/client.py", line 409, in _request
    data = payload.JsonPayload(json, dumps=self._json_serialize)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/aiohttp/payload.py", line 398, in __init__
    dumps(value).encode(encoding),
    ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Url is not JSON serializable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_webserver/login/_registration.py", line 213, in _invitations_request_context
    yield url
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_webserver/login/_registration.py", line 281, in check_and_consume_invitation
    content = await validate_invitation_url(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_webserver/invitations/_core.py", line 93, in validate_invitation_url
    with _handle_exceptions_as_invitations_errors():
  File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_webserver/invitations/_core.py", line 58, in _handle_exceptions_as_invitations_errors
    raise InvitationsServiceUnavailableError(
simcore_service_webserver.invitations.errors.InvitationsServiceUnavailableError: Cannot process invitations

Related issue/s

How to test

Dev-ops checklist

codecov[bot] commented 13 hours ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.42%. Comparing base (ca228c3) to head (07e98d9).

:exclamation: There is a different number of reports uploaded between BASE (ca228c3) and HEAD (07e98d9). Click for more details.

HEAD has 28 uploads less than BASE | Flag | BASE (ca228c3) | HEAD (07e98d9) | |------|------|------| |unittests|31|3|
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #6808 +/- ## ========================================== - Coverage 88.42% 79.42% -9.01% ========================================== Files 1545 615 -930 Lines 61627 30853 -30774 Branches 2157 263 -1894 ========================================== - Hits 54495 24505 -29990 + Misses 6803 6288 -515 + Partials 329 60 -269 ``` | [Flag](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | Coverage Δ | | |---|---|---| | [integrationtests](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `64.75% <ø> (ø)` | | | [unittests](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `82.28% <ø> (-4.06%)` | :arrow_down: | | [Components](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | Coverage Δ | | |---|---|---| | [api](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [pkg_aws_library](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [pkg_dask_task_models_library](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [pkg_models_library](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [pkg_notifications_library](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [pkg_postgres_database](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [pkg_service_integration](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [pkg_service_library](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [pkg_settings_library](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [pkg_simcore_sdk](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `77.36% <ø> (-8.00%)` | :arrow_down: | | [agent](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [api_server](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [autoscaling](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [catalog](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [clusters_keeper](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [dask_sidecar](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [datcore_adapter](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [director](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [director_v2](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `76.53% <ø> (-14.61%)` | :arrow_down: | | [dynamic_scheduler](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [dynamic_sidecar](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `59.86% <ø> (-29.86%)` | :arrow_down: | | [efs_guardian](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [invitations](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [osparc_gateway_server](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `79.79% <ø> (-5.70%)` | :arrow_down: | | [payments](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [resource_usage_tracker](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [storage](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [webclient](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `∅ <ø> (∅)` | | | [webserver](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) | `84.10% <ø> (-4.60%)` | :arrow_down: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation). Last update [ca228c3...07e98d9](https://app.codecov.io/gh/ITISFoundation/osparc-simcore/pull/6808?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ITISFoundation).

🚨 Try these New Features:

sonarcloud[bot] commented 10 hours ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud