https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
d

Davide Paolo Tua

08/25/2022, 11:17 AM
Hi all, I am doing an upgrade from v3.xxx to v6.xxx (pretty painful 😛 ). I have some issues never seen before with dataloaders, though. First, it seems that the load for any dataloader is called once per field (so it's not batched anymore? :/) Second, I seem to get randomly this exception when running tests:
Copy code
13:12:30.684 [ForkJoinPool.commonPool-worker-5] WARN  n.g.e.SimpleDataFetcherExceptionHandler - Exception while fetching data (/loadBoxes/boxes[3]/events[0]/user/roles[0]/healthInstitution) : Index 162 out of bounds for length 162
java.lang.ArrayIndexOutOfBoundsException: Index 162 out of bounds for length 162
	at java.base/java.util.HashMap.valuesToArray(HashMap.java:973)
	at java.base/java.util.HashMap$Values.toArray(HashMap.java:1050)
	at java.base/java.util.ArrayList.addAll(ArrayList.java:670)
	at kotlin.collections.CollectionsKt__MutableCollectionsKt.addAll(MutableCollections.kt:116)
	at kotlin.collections.CollectionsKt__IterablesKt.flatten(Iterables.kt:49)
	at com.expediagroup.graphql.dataloader.KotlinDataLoaderRegistry.getCurrentFutures(KotlinDataLoaderRegistry.kt:64)
Did anyone already had that error? 😕
s

Shane Myrick

08/29/2022, 5:58 PM
This is the line that seems to be failing: https://github.com/ExpediaGroup/graphql-kotlin/blob/095b056b74d52237b73cef872fdbd8[…]com/expediagroup/graphql/dataloader/KotlinDataLoaderRegistry.kt So maybe you are mutating the registry in some way on your end? As for the updates there have been some significant changes to data loaders since 3.x. I would check the release notes for more details. https://github.com/ExpediaGroup/graphql-kotlin/releases You might want to consider make a jump to 4.x by reading those notes and applying any required changes, then 5.x, then 6.x
36 Views