@databricks/sdk-experimental (pinned by AppKit): SCIM v2 list() iterators never advance startIndex and never terminate
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, typescript
- Domain
- api
Research direction
The bug is in the shipped dist/apis/iam/api.js of @databricks/sdk-experimental, in the async *list generators of the six SCIM V2 services (for example ServicePrincipalsV2Service). Read that loop first: request never changes, so startIndex never advances. Done means each generator adds the page length to startIndex and stops on an empty page, verified with a mocked SCIM response. The source likely lives in the upstream SDK repo, not this one, so confirm where to make the change first.
Written by the indexing model from the issue text.
Description
Summary
The six SCIM v2 list() async iterators in @databricks/sdk-experimental request the same page on every pass. When the result is not empty they yield the first page again and again and never finish.
AppKit pins @databricks/sdk-experimental 0.17.0 and gives apps its WorkspaceClient, so an AppKit app that iterates users, groups or service principals this way hangs and keeps calling the SCIM API.
I am filing this here because the SDK's own tracker (the bugs.url in its package.json, github.com/databricks/databricks-sdk-js/issues) is not publicly reachable. Please move it if there is a better place.
Affected
@databricks/sdk-experimental0.17.0 and 0.18.0 (the latest), indist/apis/iam/api.js.- Workspace client:
usersV2.list,groupsV2.list,servicePrincipalsV2.list. - Account client:
accountUsersV2.list,accountGroupsV2.list,accountServicePrincipalsV2.list.
I checked every async iterator in 0.18.0 (127): these six are the only ones that loop on an unchanged request.
Code as shipped (0.18.0, ServicePrincipalsV2Service)
async *list(request, context) {
while (true) {
const response = await this._list(request, context);
if (context?.cancellationToken &&
context?.cancellationToken.isCancellationRequested) {
break;
}
if (!response.Resources || response.Resources.length === 0) {
break;
}
for (const v of response.Resources) {
yield v;
}
}
}
request is never changed, so startIndex stays where the caller set it. The loop ends only on an empty page, and a first page that has items never becomes empty.
Reproduce
On any workspace that has at least one service principal:
import {WorkspaceClient} from "@databricks/sdk-experimental";
const w = new WorkspaceClient({});
let n = 0;
for await (const sp of w.servicePrincipalsV2.list({})) {
n++;
if (n > 10_000) throw new Error("still iterating"); // always reached
}
The same items come back in the same order on every pass.
Expected
After each page, add the number of items returned to startIndex and stop on an empty page. The modular SDK already does this in databricks/sdk-js, packages/scim/src/v1/client.ts:
pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length);
Workaround
Page explicitly: call the SCIM list endpoint with startIndex and count, and add each page's length to startIndex until a page comes back empty.
- Dominant language
- TypeScript
- Stars
- 119
- Forks
- 36
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 37
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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 databricks/appkit
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
databricks/appkit#729 ·
Maintainers usually reply within 3 days
-
@databricks/lakebase: pool drops maxLifetimeSeconds and other pg options, so connections never recycle and Unity Catalog claims access fails after 4 hoursPossibly taken @billmcmillin claimed this 5 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 20/100
databricks/appkit#718 ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
databricks/appkit#699 ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
databricks/appkit#648 · 2 comments ·
Maintainers usually reply within 3 days
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
databricks/appkit#603 ·
Maintainers usually reply within 3 days
All issues in databricks/appkit
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jupyterlite/jupyterlite#2111 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
karlhorky/electron-app-patcher#241 ·
Maintainers usually reply within 1 day
-
Tab bar scrolls past its last tab in Firefox until no tabs are visiblePossibly taken @daviwil claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-theia/theia#18367 ·
Maintainers usually reply within 2 days
-
Server-side render fails with "requestAnimationFrame is not defined" when the room has a video nodePossibly taken @jesusmpc claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
InditexTech/weavejs#1294 ·
Maintainers usually reply within 1 day