Request never resolves if URL is too long

Aberta
#1,890 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
typescript
Domínio
api

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
TypeScript
Estrelas
833
Forks
240
Métricas de merge de PRs
Nenhum PR com merge em 30d

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de microsoftgraph/msgraph-sdk-javascript

Todas as issues de microsoftgraph/msgraph-sdk-javascript

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.