Infinite loop when using nextLink in GET /me/people response

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

还没有人认领这个 Issue。

评估

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

调研方向

Start with the Node client entry point shown in the report, client.api('/me/people'), and reproduce the response using SDK version 3.0.7. Inspect whether the returned @odata.nextLink preserves the same results and skip=0; done means pagination advances or omits nextLink when no people remain.

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

描述

Bug Report

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

For more information, see the CONTRIBUTING guide.

Description

In my app, I'm using the people API to return a list of relevant people to the logged-in user. I'm then taking the nextLink in the API response to request the remaining people, but this results in an infinite loop. After taking a closer look, I noticed that the skip param value in the @odata.nextLink URL is 0, which I believe is the culprit.

Steps to Reproduce

For brevity, I'm including code to get the initial nextLink response, but I can include my looping logic if needed.

import { Client } from '@microsoft/microsoft-graph-client';

const client = Client.init({
    authProvider: (done) => done(null, 'ACCESS_TOKEN')
  });

let request = client.api('/me/people');

const properties = [
  'id',
  'displayName',
  'givenName',
  'surname',
  'scoredEmailAddresses',
  'phones'
];

request = request.select(properties);

const response = await request.get();
console.log(response['@odata.nextLink']);

The console should log https://graph.microsoft.com/v1.0/me/people?%24select=id%2cdisplayName%2cgivenName%2csurname%2cscoredEmailAddresses%2cphones&%24skip=0.

Expected behavior: The skip param in the @odata.nextLink URL should be offset by the number of returned results in order to request the following "page." If there are no more people to return, @odata.nextLink should be undefined.

Actual behavior: The @odata.nextLink URL in the response has a skip param of 0, thereby returning the same results in following requests and resulting in an infinite loop.

Usage Information

SDK Version - 3.0.7

  • Node (Check, if using Node version of SDK)

Node Version - 20.11.1

主要语言
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 摘要。