Request never resolves if URL is too long

Aperta
#1,890 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
api

Direzione di ricerca

Begin at the client.api(...).get() and select(...) entry points shown in the reproduction, then trace URL construction and request error handling. Add a regression test with an oversized URL and repeated $select fields, and verify that the request settles by resolving or rejecting as expected.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

status:waiting-for-triage type:bug
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

Lingua principale
TypeScript
Stelle
833
Fork
240
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoftgraph/msgraph-sdk-javascript

Tutte le issue di microsoftgraph/msgraph-sdk-javascript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.