Skip to content
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

Exception when starting LocalEvaluationClient when there is a Flag segment that uses User ID or Device ID #14

Closed
mpomorski opened this issue Nov 27, 2023 · 2 comments

Comments

@mpomorski
Copy link

mpomorski commented Nov 27, 2023

Amplitude UI allows you to configure different segments of targeted users.

In a segment you can filter by either User ID or Device ID.

Screenshot 2023-11-27 at 13 55 45

When there is a locally evaluated flag in a project that uses segmentation filter like the above it throws an unhandled exception when performing

    LocalEvaluationClient localEvaluationClient = Experiment.initializeLocal(apiKey);
    localEvaluationClient.start();

It makes the client totally unusable.

Stack trace:

Exception in thread "OkHttp Dispatcher" java.lang.NoClassDefFoundError: kotlinx/serialization/internal/EnumsKt
	at com.amplitude.experiment.evaluation.serialization.SerialOperator$Companion$$cachedSerializer$delegate$1.invoke(Serialization.kt:138)
	at com.amplitude.experiment.evaluation.serialization.SerialOperator$Companion$$cachedSerializer$delegate$1.invoke(Serialization.kt:138)
	at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
	at com.amplitude.experiment.evaluation.serialization.SerialOperator$Companion.serializer(Serialization.kt:138)
	at com.amplitude.experiment.evaluation.serialization.SerialUserPropertyFilter$$serializer.childSerializers(Serialization.kt:163)
	at kotlinx.serialization.internal.PluginGeneratedSerialDescriptor$childSerializers$2.invoke(PluginGeneratedSerialDescriptor.kt:36)
	at kotlinx.serialization.internal.PluginGeneratedSerialDescriptor$childSerializers$2.invoke(PluginGeneratedSerialDescriptor.kt:36)
	at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
	at kotlinx.serialization.internal.PluginGeneratedSerialDescriptor.getChildSerializers(PluginGeneratedSerialDescriptor.kt:36)
	at kotlinx.serialization.internal.PluginGeneratedSerialDescriptor.getElementDescriptor(PluginGeneratedSerialDescriptor.kt:76)
	at kotlinx.serialization.descriptors.SerialDescriptorKt$elementDescriptors$1$1.next(SerialDescriptor.kt:284)
	at kotlinx.serialization.descriptors.SerialDescriptorKt$elementDescriptors$1$1.next(SerialDescriptor.kt:279)
	at kotlinx.serialization.internal.PluginGeneratedSerialDescriptorKt.hashCodeImpl(PluginGeneratedSerialDescriptor.kt:137)
	at kotlinx.serialization.internal.PluginGeneratedSerialDescriptor$_hashCode$2.invoke(PluginGeneratedSerialDescriptor.kt:44)
	at kotlinx.serialization.internal.PluginGeneratedSerialDescriptor$_hashCode$2.invoke(PluginGeneratedSerialDescriptor.kt:44)
	at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
	at kotlinx.serialization.internal.PluginGeneratedSerialDescriptor.get_hashCode(PluginGeneratedSerialDescriptor.kt:44)
	at kotlinx.serialization.internal.PluginGeneratedSerialDescriptor.hashCode(PluginGeneratedSerialDescriptor.kt:97)
	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
	at kotlinx.serialization.json.internal.DescriptorSchemaCache.get(SchemaCache.kt:35)
	at kotlinx.serialization.json.internal.DescriptorSchemaCache.getOrPut(SchemaCache.kt:27)
	at kotlinx.serialization.json.internal.JsonNamesMapKt.getJsonNameIndex(JsonNamesMap.kt:52)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeObjectIndex(StreamingJsonDecoder.kt:139)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeElementIndex(StreamingJsonDecoder.kt:92)
	at com.amplitude.experiment.evaluation.serialization.SerialUserPropertyFilter$$serializer.deserialize(Serialization.kt:163)
	at com.amplitude.experiment.evaluation.serialization.SerialUserPropertyFilter$$serializer.deserialize(Serialization.kt:163)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
	at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:535)
	at kotlinx.serialization.internal.ListLikeSerializer.readElement(CollectionSerializers.kt:80)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
	at com.amplitude.experiment.evaluation.serialization.SerialSegmentTargetingConfig$$serializer.deserialize(Serialization.kt:116)
	at com.amplitude.experiment.evaluation.serialization.SerialSegmentTargetingConfig$$serializer.deserialize(Serialization.kt:116)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
	at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:535)
	at kotlinx.serialization.internal.ListLikeSerializer.readElement(CollectionSerializers.kt:80)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:79)
	at com.amplitude.experiment.evaluation.serialization.SerialFlagConfig$$serializer.deserialize(Serialization.kt:36)
	at com.amplitude.experiment.evaluation.serialization.SerialFlagConfig$$serializer.deserialize(Serialization.kt:36)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
	at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:535)
	at kotlinx.serialization.internal.ListLikeSerializer.readElement(CollectionSerializers.kt:80)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
	at kotlinx.serialization.json.Json.decodeFromString(Json.kt:100)
	at com.amplitude.experiment.flag.FlagConfigApiImpl$getFlagConfigs$$inlined$request$1.onResponse(Request.kt:45)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.ClassNotFoundException: kotlinx.serialization.internal.EnumsKt
	at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 73 more
@tyiuhc
Copy link
Collaborator

tyiuhc commented Nov 28, 2023

@mpomorski Many thanks for raising this issue, this has been addressed in v1.2.3. Please let us know if you continue to encounter this error.

@mpomorski
Copy link
Author

Nice one, thanks!
I confirm I can't reproduce the issue with the latest version of the lib.
The desired segmentation works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants