node-auth0 icon indicating copy to clipboard operation
node-auth0 copied to clipboard

Library is paging by default on /get/connections even though API does not have paging enabled by default

Open kopernic-pl opened this issue 3 years ago • 4 comments

Checklist

  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Description

Our Auth0 tenant has quite a lot of OIDC enterprise connections (hundreds).

We were inspired by the Management API doc to believe that get connections does not page results by default (https://auth0.com/docs/api/management/v2/connections/get-connections).

But when using node-auth0 library, results are paged by default source code doc.

Reproduction

  1. Create a lot of OIDC enterprise connections
  2. issue fetchOIDCConnections = () => { return this.client().then(client => client.connections.getAll({strategy: 'oidc'})); };
  3. Expected: all connections; received: only first page of connections.

Additional context

No response

node-auth0 version

"auth0": "3.7.1"

Node.js version

16.x in AWS Lambda runtime

kopernic-pl avatar Oct 09 '23 08:10 kopernic-pl

Hi @kopernic-pl - thanks for raising this.

Requests to Management API v2 endpoints return a maximum of 50 items, so I suspect this is the limit you're hitting. In order to request more items you have to use pagination - either offset or checkpoint (for more than 1000 connections).

There are examples of both of those here:

  • https://github.com/auth0/node-auth0/blob/master/EXAMPLES.md#paginate-through-a-list-of-users
  • https://github.com/auth0/node-auth0/blob/master/EXAMPLES.md#paginate-through-a-list-of-logs-using-checkpoint-pagination

adamjmcgrath avatar Oct 09 '23 08:10 adamjmcgrath

Is this limit on Management API itself?

  • if this is the case, then A0 mgmt API doc needs a fix. Or limit/paging is imposed by default by this client lib?
  • maybe lib needs a bit more detailed documentation. I really missed the doc/info about paging/limits behavior in client - somehow I was expecting the client lib to follow the API behavior.

kopernic-pl avatar Oct 09 '23 09:10 kopernic-pl

Is this limit on Management API itself?

Correct

if this is the case, then A0 mgmt API doc needs a fix.

This is the best place for product feedback https://auth0.com/feedback

I really missed the doc/info about paging/limits behavior in client

Which doc was this? Perhaps we can make it available again

adamjmcgrath avatar Oct 09 '23 09:10 adamjmcgrath

Closing as I believe https://github.com/auth0/node-auth0/issues/950#issuecomment-1752578920 answers your question

adamjmcgrath avatar Oct 18 '23 11:10 adamjmcgrath