Skip to content

fix(ui): fix useGetUserGroupUrns when user urn is empty #13359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Masterchen09
Copy link
Contributor

This PR fixes an issue with useGetUserGroupUrns when the user urn is empty (or undefined), this can happen when the user context (useUserContext.ts) is used for getting the user urn e.g. in AssetsYouOwn.tsx.

A query with an empty user urn causes an exception in the GMS:

2025-04-29 12:19:25,568 [ForkJoinPool.commonPool-worker-5] ERROR c.l.datahub.graphql.GmsGraphQLEngine:3140 - Failed to load Entities of type: CorpUser, keys: [] Failed to batch load Datasets
2025-04-29 12:19:25,570 [ForkJoinPool.commonPool-worker-2] ERROR c.l.d.g.e.DataHubDataFetcherExceptionHandler:45 - Failed to execute
java.lang.RuntimeException: Failed to retrieve entities of type CorpUser
at com.linkedin.datahub.graphql.GmsGraphQLEngine.lambda$createDataLoader$274(GmsGraphQLEngine.java:3147)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.lang.RuntimeException: Failed to batch load Datasets
at com.linkedin.datahub.graphql.types.corpuser.CorpUserType.batchLoad(CorpUserType.java:108)
at com.linkedin.datahub.graphql.GmsGraphQLEngine.lambda$createDataLoader$274(GmsGraphQLEngine.java:3138)
... 7 common frames omitted
Caused by: java.lang.RuntimeException: Failed to retrieve entity with urn , invalid urn
at com.linkedin.common.urn.UrnUtils.getUrn(UrnUtils.java:35)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at com.linkedin.datahub.graphql.types.corpuser.CorpUserType.batchLoad(CorpUserType.java:85)
... 8 common frames omitted
2025-04-29 12:19:25,571 [ForkJoinPool.commonPool-worker-2] ERROR c.datahub.graphql.GraphQLController:153 - Errors while executing query: query getUserGroupsUrns($urn: String!, $start: Int!, $count: Int!) {
corpUser(urn: $urn) {
relationships(
input: {types: ["IsMemberOfGroup", "IsMemberOfNativeGroup"], direction: OUTGOING, start: $start, count: $count}
) {
start
count
total
relationships {
entity {
urn
type
__typename
}
__typename
}
__typename
}
__typename
}
}
, result: {errors=[{message=An unknown error occurred., locations=[{line=2, column=3}], path=[corpUser], extensions={code=500, type=SERVER_ERROR, classification=DataFetchingException}}], data={corpUser=null}, extensions={tracing={version=1, startTime=2025-04-29T12:19:25.566567870Z, endTime=2025-04-29T12:19:25.571188411Z, duration=4629035, parsing={startOffset=548860, duration=418741}, validation={startOffset=976695, duration=391058}, execution={resolvers=[{path=[corpUser], parentType=Query, returnType=CorpUser, fieldName=corpUser, startOffset=1744620, duration=2193243}]}}}}, errors: [DataHubGraphQLError{path=[corpUser], code=SERVER_ERROR, locations=[SourceLocation{line=2, column=3}]}]
2025-04-29 12:19:25,571 [ForkJoinPool.commonPool-worker-2] INFO c.datahub.graphql.GraphQLController:166 - Executed operation getUserGroupsUrns in 4 ms

I have solved it by also accepting undefined user urns, but skipping the query when this is the case.

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added product PR or Issue related to the DataHub UI/UX community-contribution PR or Issue raised by member(s) of DataHub Community labels Apr 29, 2025
@datahub-cyborg datahub-cyborg bot added the needs-review Label for PRs that need review from a maintainer. label Apr 29, 2025
@esteban
Copy link
Collaborator

esteban commented May 14, 2025

Hello @Masterchen09. Thanks for submitting your PR!

@datahub-cyborg datahub-cyborg bot added pending-submitter-response Issue/request has been reviewed but requires a response from the submitter and removed needs-review Label for PRs that need review from a maintainer. labels May 14, 2025
@datahub-cyborg datahub-cyborg bot added merge-pending-ci A PR that has passed review and should be merged once CI is green. and removed pending-submitter-response Issue/request has been reviewed but requires a response from the submitter labels May 15, 2025
@esteban esteban merged commit a00e65c into datahub-project:master May 15, 2025
23 of 24 checks passed
@Masterchen09 Masterchen09 deleted the fix-use-get-user-group-urns branch May 15, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution PR or Issue raised by member(s) of DataHub Community merge-pending-ci A PR that has passed review and should be merged once CI is green. product PR or Issue related to the DataHub UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants