Skip to content

Warning is logged for each dropped event when destination drop rules are enabled in device-mode destination filters #15

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

Closed
mecoFarid opened this issue Jun 4, 2025 · 3 comments
Assignees

Comments

@mecoFarid
Copy link

mecoFarid commented Jun 4, 2025

Describe the bug
When device-mode destination filters are enabled and Segment destination drop rules ("type": "drop") are applied, a warning is logged for each dropped event.

W  java.util.concurrent.ExecutionException: java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Any

To Reproduce
Steps to reproduce the behavior:

  1. Enable device-mode destination filters in your Android app.
  2. In the Segment dashboard, create a destination filter with the "drop" action for a specific event.
  3. In the app, track the event you set to be dropped.
  4. Launch the app and trigger the event by navigating to the related screen.
  5. Check the Android console logs for the message: "null cannot be cast to non-null type"
  6. Confirm that this warning appears.

Expected behavior
Warning W java.util.concurrent.ExecutionException: java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Any is not displayed at all or at worst it is displayed with proper message (e.g. XXX event is dropped after applying filter).

Platform (please complete the following information):

  • Library Version in use: 1.0.1
  • Platform being tested: Android
  • Integrations in use: Firebase (device-mode)

Additional context
Full stacktrace:

 W  java.util.concurrent.ExecutionException: java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Any
 W  	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
 W  	at java.util.concurrent.FutureTask.get(FutureTask.java:205)
 W  	at com.segment.analytics.substrata.kotlin.JSScope.await(SafeEngine.kt:84)
 W  	at com.segment.analytics.substrata.kotlin.JSScope.await$default(SafeEngine.kt:82)
 W  	at com.segment.analytics.liveplugins.kotlin.LivePlugin.execute(LivePlugin.kt:69)
 W  	at com.segment.analytics.kotlin.core.platform.Mediator.execute(Mediator.kt:47)
 W  	at com.segment.analytics.kotlin.core.platform.Timeline.applyPlugins(Timeline.kt:62)
 W  	at com.segment.analytics.kotlin.core.platform.Timeline.applyPlugins(Timeline.kt:54)
 W  	at com.segment.analytics.kotlin.core.platform.DestinationPlugin.process(Plugin.kt:135)
 W  	at com.segment.analytics.kotlin.core.platform.DestinationPlugin.execute(Plugin.kt:162)
 W  	at com.segment.analytics.kotlin.core.platform.Mediator.execute(Mediator.kt:44)
 W  	at com.segment.analytics.kotlin.core.platform.Timeline.applyPlugins(Timeline.kt:62)
 W  	at com.segment.analytics.kotlin.core.platform.Timeline.applyPlugins(Timeline.kt:54)
 W  	at com.segment.analytics.kotlin.core.platform.Timeline.process(Timeline.kt:36)
 W  	at com.segment.analytics.kotlin.core.Analytics$process$1.invokeSuspend(Analytics.kt:523)
 W  	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
 W  	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
 W  	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
 W  	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
 W  	at java.lang.Thread.run(Thread.java:1012)
 W  Caused by: java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Any
 W  	at com.segment.analytics.substrata.kotlin.JSEngine.call(JSEngine.kt:208)
 W  	at com.segment.analytics.liveplugins.kotlin.LivePlugin$execute$ret$1.invoke(LivePlugin.kt:70)
 W  	at com.segment.analytics.liveplugins.kotlin.LivePlugin$execute$ret$1.invoke(LivePlugin.kt:69)
 W  	at com.segment.analytics.substrata.kotlin.JSScope.optimize$lambda-4(SafeEngine.kt:101)
 W  	at com.segment.analytics.substrata.kotlin.JSScope.$r8$lambda$hVLtNz8KE8RmkS6LOU8KIOX5TaI(Unknown Source:0)
 W  	at com.segment.analytics.substrata.kotlin.JSScope$$ExternalSyntheticLambda2.call(D8$$SyntheticClass:0)
 W  	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
 W  	... 3 more

cc: @trod-123

@wenxi-zeng
Copy link
Contributor

hi @mecoFarid, please update to the latest version. our recent release have a fix for situation like this.

@mecoFarid
Copy link
Author

Hi @wenxi-zeng thanks for quick reply. I just tried the latest version (1.2.0) of this library with:

  • com.segment.analytics.kotlin:core:1.16.3
  • com.segment.analytics.kotlin:android:1.16.3

And the warning is still printed. Is it likely the problem arises from the :core and :android libraries not being in the latest version?

@wenxi-zeng
Copy link
Contributor

yes. it's possible. please update analytics to the latest 1.19.2 and analytics-kotlin-live to 1.1.0. if the issue still persists, feel free to re-open this issue.

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