statsig-io / roku-sdk

Statsig's SDK for client-side roku applications
ISC License
1 stars 0 forks source link

Crash when loss of internet occurs #1

Closed AndyHankewycz closed 1 year ago

AndyHankewycz commented 1 year ago

https://github.com/statsig-io/roku-sdk/blob/a0d300529fb57a1f0bc1635d58383b3594646203/components/statsigsdk/StatsigTask.brs#L124

This is a trap I've come across. When msg is invalid and it's passed to parseJSON on the following line

From Roku's docs, Wait can return invalid https://developer.roku.com/docs/references/brightscript/language/global-utility-functions.md#waittimeout-as-integer-port-as-object-as-object

Wait will return after timeout milliseconds if no messages are received. In this case, Wait returns a type "invalid".

vijaye-statsig commented 1 year ago

cc: @tore-statsig

tore-statsig commented 1 year ago

Thanks for the report, we will take a look

tore-statsig commented 1 year ago

I havent tested this yet because my roku device is at work, but I think this is all that needs to change (see linked PR). Since the Roku SDK is copied into your app, you can likely apply this change now without waiting for it to be pushed.

Let me know if this resolves your issue

AndyHankewycz commented 1 year ago

Thanks @tore-statsig, we did push a fix for this on our end the other day which I shared with you in the PR