-
Notifications
You must be signed in to change notification settings - Fork 232
Description
Describe the bug
I had a bug in my code that tried to request a massive url like https://graph.microsoft.com/v1.0/sites/$siteId/drive/root/delta?token=$token&$select=[...], which was 16,343 characters long, mainly in the $select query param. When calling await client.api(url).get(), it never resolves or rejects but hangs forever.
Expected behavior
The request should resolve or throw an error.
How to reproduce
Call await client.api('https://graph.microsoft.com/v1.0/sites/$siteId/drive/root/delta?token=$token&$select=$select').get() with a sufficiently large value for $select. Fields can be repeated in $select, in my example the select content.downloadUrl,id,webUrl,file,folder,name,lastModifiedDateTime,lastModifiedBy,createdDateTime,createdBy,size,cTag,eTag,parentReference,deleted was repeated over 100 times.
SDK Version
3.0.7
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
No response
Configuration
- MacOS Sequoia, Debian Bookworm
Does not appear to be specific to the configuration
Other information
The $select param should be deduplicated by the SDK. The way I ended up in this situation was I had code like this:
import {
Client,
} from "@microsoft/microsoft-graph-client";
async function example(client: Client) {
const siteId = "someid"
const select = ["content.downloadUrl", "id", /*etc*/]
const client: Client
let cursor = ""
while (true) {
if (!cursor) cursor = `/site/${siteId}/drive/root/delta`
const response = await client.get(cursor).select(select).get()
cursor = response['@odata.nextLink']
// Process data in response
if (!cursor) break
}
}Eventually the select param gets so large that it causes this error