fhir-server: Pagination broken - Next URL more than 2048 characters
Describe the bug The “next” url in the link section of a Bundle resource results in a 404 response. I believe this is related to the URL specified as “next” is longer than 2048 characters. In our case, it is 5,399 characters. We are using the Azure API for FHIR.
FHIR Version? R4
Data provider? CosmosDB
To Reproduce Steps to reproduce the behavior:
- Send a GET response to
/Encounter(We have > 100,000 Encounters) - Copy the link of the URL tagged with relation: next in the link object.
- Send a GET to the link copied from step 2.
- You should get a 404 response if the URL is too long
Expected behavior Next page of Encounter resources should display
Actual behavior
A 404 response message is returned saying The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Here is our initial call to /Encounter:

Here is the response when calling the URL from the next link:

About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 18 (8 by maintainers)
@mikemassa84 - we recently addressed the issue by introducing header “x-ms-documentdb-responsecontinuationtokenlimitinkb”. The next link in the bundle has a continuation token size limit of 3KB. You have flexibility to tweak the continuation token size between 1 to 3KB using header. Please let us know if your issue is addressed with the header.