Skip to content

Failure when reading more than 500 messages from a MESH mailbox #60

Description

@vivanov-grailbio

Context

We are using version 3.2.1 of the MESH-client.
We are testing the last step of the pseudocode for MESH inbox cycle explained here: https://digital.nhs.uk/developer/api-catalogue/message-exchange-for-social-care-and-health-api#overview--mesh-api-pseudocode

Whenever our application tries to pull messages from MESH and there are more than 500 messages the MESH client throws the following exception:

ERROR MissingSchema: Invalid URL '/messageexchange/**********/inbox...
No scheme supplied. Perhaps you meant https:///messageexchange/**********/inbox...

With the following stack trace:

File \"/var/task/mesh_client/__init__.py\", line 816, in iterate_message_ids",
  result = self._inbox_v2_page(url=next_page)",
File \"/var/task/mesh_client/__init__.py\", line 507, in _inbox_v2_page",
  response = self._session.get(url, timeout=self._timeout, params=params)",
File \"/var/task/requests/sessions.py\", line 602, in get",
  return self.request(\"GET\", url, **kwargs)",
File \"/var/task/requests/sessions.py\", line 575, in request",
  prep = self.prepare_request(req)",
File \"/var/task/requests/sessions.py\", line 486, in prepare_request",
  p.prepare(",
File \"/var/task/requests/models.py\", line 368, in prepare",
  self.prepare_url(url, params)",
File \"/var/task/requests/models.py\", line 439, in prepare_url",
  raise MissingSchema(",

This occurs when trying to load the second batch of message (500 till the end). The reason is that the client expects the links object in the response to contain a fully qualifying URI: https://github.com/NHSDigital/mesh-client/blob/develop/mesh_client/__init__.py#L807-L817
Where instead the returned links object looks like this:

"links": {
        "self": "/messageexchange/X26ABC1/inbox"
    },

Potential Fix

This can be fixed by either

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions