Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occasional BadRequest status code is returned because of URL format #2597

Closed
davit-asryan-veritas opened this issue Jul 26, 2024 · 2 comments
Labels

Comments

@davit-asryan-veritas
Copy link

Describe the bug

Microsoft Support pointed out that some of the URL formatting is incorrect and is leading to us having issues with occasional BadRequest status codes.

Here is the issue we are facing

Request

https://graph.microsoft.com/v1.0/users/ef1505b8-df01-4671-869f-ab69cba55381/chats/getAllMessages()?$filter=lastModifiedDateTime+gt+2024-07-01T13%3a59%3a59.999Z+and+lastModifiedDateTime+lt+2024-07-02T14%3a00%3a00.000Z&$orderby=lastModifiedDateTime&$select=from%2creplyToId%2chostedContents%2creactions&$top=60&model=A%2cA&$skiptoken=U2tpc[REDACTED]

Response

{"error":{"code":"BadRequest","message":"UnknownError","innerError":{"date":"2024-07-23T04:22:32","request-id":"6b3aba62-a1f2-4fb4-a46c-3415cd177d50","client-request-id":"242fa498-20d6-41ee-b760-0902b0ab5a1c"}}}

Expected behavior

Microsoft Support

The Graph request Url is not good to me. No (), for any parameter (exclude the first), we need to use &$.
https://graph.microsoft.com/v1.0/users/ef1505b8-df01-4671-869f-ab69cba55381/chats/getAllMessages()?$filter=lastModifiedDateTime gt 2024-07-01T13%3A59%3A59.999Z and lastModifiedDateTime lt 2024-07-02T14%3A00%3A00.000Z&$orderby=lastModifiedDateTime&$select=from,replyToId,hostedContents,reactions&$top=60&model=A

The statement suggests that the SDK generated url is wrong and should be
https://graph.microsoft.com/v1.0/users/ef1505b8-df01-4671-869f-ab69cba55381/chats/getAllMessages?$filter=lastModifiedDateTime gt 2024-07-01T13%3A59%3A59.999Z and lastModifiedDateTime lt 2024-07-02T14%3A00%3A00.000Z&$orderby=lastModifiedDateTime&$select=from,replyToId,hostedContents,reactions&$top=60&$model=A

How to reproduce

This issue is only reproduced in our customer environment with a very large number of users(~40000 users), after ~150000 requests. Here is the request id 6b3aba62-a1f2-4fb4-a46c-3415cd177d50.
P.S. We know that this should probably be addressed by Microsoft Support and the SDK team most probably cannot trace requests, but since Microsoft Support has explicitly asked us to open a ticket here, we are doing so.

SDK Version

5.44.0

Latest version known to work for scenario above?

No response

Known Workarounds

No

Debug output

No response

Configuration

No response

Other information

No response

@davit-asryan-veritas davit-asryan-veritas added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jul 26, 2024
@andrueastman
Copy link
Member

Thanks for raising this @davit-asryan-veritas

Any chance you can share a code sample of how the request is constructed to help understand better if the SDK is constructing the request incorrectly?

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Jul 29, 2024
@davit-asryan-veritas
Copy link
Author

@andrueastman Here's a simplified code sample

_client.Users[userId].Chats.GetAllMessages.GetAsGetAllMessagesGetResponseAsync(o =>
{
o.QueryParameters.Model = _requestModel;
o.QueryParameters.Filter = filter;
o.QueryParameters.Select = new string[] { "from", "replyToId", "hostedContents", "reactions" };
o.QueryParameters.Top = _exportApiSettings.MessagesPageSize;
})

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close Status: No recent activity labels Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants