Infinite loop when using nextLink in GET /me/people response
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- node.js, typescript
- Domain
- api
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- TypeScript
- Stars
- 833
- Forks
- 240
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoftgraph/msgraph-sdk-javascript
-
status:waiting-for-triage
Difficulty 1/5 Under an hour Newbie friendliness 62/100
-
Is anyone here? Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
microsoftgraph/msgraph-sdk-javascript#2005 · 1 reaction ·
-
Is it really correct that the Javascript version of the graph SDK doesn't offer typed requests? Openstatus:waiting-for-triage
Difficulty 5/5 Over a week Newbie friendliness 42/100
-
status:waiting-for-triage type:bug
Difficulty 3/5 1-2 days Newbie friendliness 48/100
microsoftgraph/msgraph-sdk-javascript#1999 · 2 comments · 1 reaction ·
-
status:waiting-for-triage type:bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
All issues in microsoftgraph/msgraph-sdk-javascript
Similar issues
-
Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenNSW/nsw-srilanka#497 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
0xMiden/bridge-portal#132 ·
-
react-doctor severity:warning tech-debt
Difficulty 1/5 Under an hour Newbie friendliness 88/100
digidem/comapeo-cloud-app#403 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100