Skip to content

Graph API Pagination Fails with 502 Bad Gateway When Using @odata.nextLink on Channel Messages #4040

Description

@winterman1102

Describe the bug
When calling the Microsoft Graph API to retrieve channel messages with pagination, the first page returns successfully. However, when using the @odata.nextLink value to retrieve the next page, the request fails with a Bad Gateway error.

To Reproduce
Steps to reproduce the behavior:
Steps to reproduce the behavior:

Call the following API to retrieve channel messages (first page works):
GET /beta/teams/{team-id}/channels/{channel-id}/messages?$expand=replies&$top=50

Extract the @odata.nextLink value from the response.
Call the @odata.nextLink URL.
Observe the error response:
{ "error": { "code": "UnknownError", "message": "Bad Gateway", "innerError": { "date": "<timestamp>", "request-id": "<request-id>", "client-request-id": "<client-request-id>" } } }
Expected behavior
The @odata.nextLink request should return the next page of messages successfully, consistent with standard Graph API pagination behavior.

Screenshots
Not applicable (API-based issue).

Desktop (please complete the following information):
OS: N/A (API call)
Client: Custom HTTP client / backend service
Version: N/A

Smartphone (please complete the following information):
Device: N/A
OS: N/A
Browser: N/A
Version: N/A

Additional context
Issue occurs specifically when using:

Pagination via @odata.nextLink

The first page consistently works, indicating:

Authentication is valid
Endpoint is correct

The failure only occurs on subsequent page retrievals.
This behavior suggests a potential issue with:

Backend pagination handling
Query parameter propagation in nextLink
Service instability or gateway issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions