Request never resolves if URL is too long

未关闭
#1,890 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
typescript
领域
api

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
TypeScript
星标
833
派生
240
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoftgraph/msgraph-sdk-javascript 的其他 Issue

查看 microsoftgraph/msgraph-sdk-javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。