Appboy / appboy-android-sdk

Public repo for the Braze Android SDK
https://www.braze.com
Other
152 stars 102 forks source link

[Bug]: Add array to BrazeProperties is not working #246

Closed mauro-poq closed 2 years ago

mauro-poq commented 2 years ago

Braze Android SDK Version

23.3.0

Steps To Reproduce

1 - Try to log a custom event including BrazeProperties including an Array as describe here; Example:

Braze.getInstance(context).logCustomEvent("test_event", BrazeProperties().addProperty("test_array", JSONArray(listOf("item1", "item2", "item3"))))

Expected Behavior

The event is sent with an array of strings

Actual Incorrect Behavior

The error below is sent to Logcat and the event is tracked without the array.

2022-10-26 12:15:51.581 15941-16026 Braze v23....Properties com.app             W  Value type is not supported. Cannot add property test_array.

Verbose Logs

2022-10-26 12:35:10.036 17392-17611 Braze v23....Properties com.poqstudio.app.elfdev             W  Value type is not supported. Cannot add property test_array.
2022-10-26 12:35:10.039 17392-17512 Braze v23....onProvider com.poqstudio.app.elfdev             D  Unable to find the xml BOOLEAN configuration value with primary key 'com_braze_ephemeral_events_enabled'.Using default value 'false'.
2022-10-26 12:35:10.039 17392-17512 Braze v23....onProvider com.poqstudio.app.elfdev             D  Using resources value for key: 'com_braze_ephemeral_events_enabled' and value: 'false'
2022-10-26 12:35:10.039 17392-17512 Braze v23.3.0 .t        com.poqstudio.app.elfdev             D  Checking if this session needs to be sealed: a46e8ec5-6556-481a-965e-edb090530a24
2022-10-26 12:35:10.039 17392-17512 Braze v23.3.0 .t        com.poqstudio.app.elfdev             D  Checking if this session needs to be sealed: a46e8ec5-6556-481a-965e-edb090530a24
2022-10-26 12:35:10.039 17392-17512 Braze v23.3.0 .p        com.poqstudio.app.elfdev             V  Attempting to log event: {
                                                                                                      "name": "ce",
                                                                                                      "data": {
                                                                                                        "n": "test_event"
                                                                                                      },
                                                                                                      "time": 1.666798510038E9,
                                                                                                      "user_id": "email@email.la",
                                                                                                      "session_id": "a46e8ec5-6556-481a-965e-edb090530a24"
                                                                                                    }
2022-10-26 12:35:10.040 17392-17508 Braze v23.3.0 .o5       com.poqstudio.app.elfdev             D  Adding event to storage with uid a226c0e6-c935-49a0-bd99-e652ee4c164b
2022-10-26 12:35:10.040 17392-17512 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  bo.app.o0 fired: commandType = ADD_BRAZE_EVENT
                                                                                                    brazeEvent = {"name":"ce","data":{"n":"test_event"},"time":1.666798510038E9,"user_id":"email@email.la","session_id":"a46e8ec5-6556-481a-965e-edb090530a24"}
                                                                                                    sessionId = null
                                                                                                    brazeRequest = null
2022-10-26 12:35:10.040 17392-17512 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  Triggering bo.app.o0 on 1 subscribers.
2022-10-26 12:35:10.041 17392-17512 Braze v23.....bo.app.k6 com.poqstudio.app.elfdev             D  In flight trigger requests is empty. Executing any pending trigger events.
2022-10-26 12:35:10.041 17392-17512 Braze v23.....bo.app.k6 com.poqstudio.app.elfdev             D  New incoming <custom_event>. Searching for matching triggers.
2022-10-26 12:35:10.041 17392-17512 Braze v23.....bo.app.k6 com.poqstudio.app.elfdev             D  Failed to match triggered action for incoming <custom_event>.
2022-10-26 12:35:10.041 17392-17512 Braze v23.3.0 .k6       com.poqstudio.app.elfdev             D  No action found for custom_event event, publishing NoMatchingTriggerEvent
2022-10-26 12:35:10.041 17392-17512 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  com.braze.events.NoMatchingTriggerEvent fired: NoMatchingTriggerEvent(sourceEventType=custom_event)
2022-10-26 12:35:10.041 17392-17512 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             I  Event was published, but no subscribers were found. But not saving event for publishing later. Event class: class com.braze.events.NoMatchingTriggerEvent
2022-10-26 12:35:10.164 17392-17548 AppsFlyer_6.5.2         com.poqstudio.app.elfdev             I  (49559) [Thread-12] data: {"country":"GB","af_timestamp":"1666798510062","appsflyerKey":"A********************J","isFirstCall":"true","customData":"{\"brazeCustomerId\":\"4f797fe7-45de-46c4-bfa1-62f5e27502e6\"}","registeredUninstall":false,"operator":"","isGaidWithGps":"true","app_version_code":"1510","eventName":"af_add_to_wishlist","model":"Pixel 4","brand":"google","deviceType":"user","deviceData":{"cpu_abi":"arm64-v8a","build_display_id":"TP1A.220624.014","dim":{"size":"2","ydp":"445.476","xdp":"442.451","y_px":"2214","x_px":"1080","d_dpi":"440"},"arch":"","cpu_abi2":""},"disk":"102354\/112213","sdk":"33","app_version_name":"22.0.8.3-67-g93164c15","device":"flame","kef666a":"bffbfe5c205693904818191b0c531a0d59181d0d5a1f12","cksm_v1":"5f42a9d39797b0255f569f13492e0f3f54","af_events_api":"1","cell":{"mnc":0,"mcc":0},"network":"WIFI","af_v2":"8c1f4234fbfa48b711773c60cbe7fe30dd2533e8","sig":"E0580B89BCECBABFE588C50038BB684B2CC9C88FA90EC16A662C7971899AA252","uid":"1666776101973-7400320174443108168","eventValue":"{\"af_currency\":\"USD\",\"af_content_id\":\"100010\",\"af_description\":\"Angled Foundation Brush\",\"af_quantity\":1,\"af_price\":\"6.00\"}","lang_code":"en","installDate":"2022-10-26_092139+0000","firstLaunchDate":"2022-10-26_092141+0000","ivc":false,"lang":"English","last_boot_time":1666778998101,"product":"flame","date2":"2022-10-26_102709-0300","counter":"43","date1":"2022-10-26_062139-0300","advertiserId":"3fae70fc-74e1-479f-8753-712586704506","advertiserIdEnabled":"true","af_v":"4a8114eb67e1600134bf5d658d296595f233ed2a","carrier":"","sensors":{"er":"na"},"af_preinstalled":"false","iaecounter":"99","sc_o":"p","tokenRefreshConfigured":false,"appUserId":"b1fc255a-1237-497b-948a-43faa76d4f10","prev_event":{"prev_event_timestamp":1666798503913,"prev_event_name":"af_content_view"},"platformextension":"android_native"}
2022-10-26 12:35:21.010 17392-17508 Braze v23....eCoroutine com.poqstudio.app.elfdev             V  Requesting data flush from automatic sync policy
2022-10-26 12:35:21.012 17392-17512 Braze v23.3.0 .Braze    com.poqstudio.app.elfdev             I  Requesting immediate data flush to Braze.
2022-10-26 12:35:21.016 17392-17512 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  bo.app.o0 fired:             commandType = ADD_REQUEST
                                                                                                                brazeEvent = null
                                                                                                                sessionId = null
                                                                                                                brazeRequest = {
                                                                                                      "respond_with": {
                                                                                                        "user_id": "email@email.la",
                                                                                                        "config": {
                                                                                                          "config_time": 1666604542
                                                                                                        }
                                                                                                      }
                                                                                                    }
2022-10-26 12:35:21.016 17392-17512 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  Triggering bo.app.o0 on 1 subscribers.
2022-10-26 12:35:21.017 17392-17512 Braze v23.3.0 .q0       com.poqstudio.app.elfdev             V  Added request to dispatcher with parameters: 
                                                                                                    {
                                                                                                      "respond_with": {
                                                                                                        "user_id": "email@email.la",
                                                                                                        "config": {
                                                                                                          "config_time": 1666604542
                                                                                                        }
                                                                                                      }
                                                                                                    }
2022-10-26 12:35:21.017 17392-17508 Braze v23.3.0 .q0       com.poqstudio.app.elfdev             V  SDK Auth is disabled, not adding token to request
2022-10-26 12:35:21.022 17392-17508 Braze v23.3.0 .k0       com.poqstudio.app.elfdev             D  Cache locked successfully for export: bo.app.k0@dfd471b
2022-10-26 12:35:21.022 17392-17508 Braze v23.3.0 .t6       com.poqstudio.app.elfdev             D  Cache locked successfully for export: bo.app.t6@37e41f6
2022-10-26 12:35:21.024 17392-17508 Braze v23.3.0 .q0       com.poqstudio.app.elfdev             D  Event dispatched: {"name":"ce","data":{"n":"test_event"},"time":1.666798510038E9,"user_id":"email@email.la","session_id":"a46e8ec5-6556-481a-965e-edb090530a24"} with uid: a226c0e6-c935-49a0-bd99-e652ee4c164b
2022-10-26 12:35:21.033 17392-17508 Braze v23.3.0 .m3       com.poqstudio.app.elfdev             D  Making request with id => "c53f2424231f29d0"
                                                                                                    to url: https://sdk.iad-05.braze.com/api/v3/data

                                                                                                    with headers:
                                                                                                    "Accept-Encoding" => "gzip, deflate"
                                                                                                    "Content-Type" => "application/json"
                                                                                                    "X-Braze-Api-Key" => "<<my_api_key>>"

                                                                                                    and JSON :
                                                                                                    {
                                                                                                      "device_id": "4f797fe7-45de-46c4-bfa1-62f5e27502e6",
                                                                                                      "time": 1666798521,
                                                                                                      "api_key": "<<my_api_key>>",
                                                                                                      "sdk_version": "23.3.0",
                                                                                                      "app_version": "22.0.8.3-67-g93164c15",
                                                                                                      "app_version_code": "1510.0.0.0",
                                                                                                      "events": [
                                                                                                        {
                                                                                                          "name": "ce",
                                                                                                          "data": {
                                                                                                            "n": "test_event"
                                                                                                          },
                                                                                                          "time": 1.666798510038E9,
                                                                                                          "user_id": "email@email.la",
                                                                                                          "session_id": "a46e8ec5-6556-481a-965e-edb090530a24"
                                                                                                        }
                                                                                                      ],
                                                                                                      "respond_with": {
                                                                                                        "user_id": "email@email.la",
                                                                                                        "config": {
                                                                                                          "config_time": 1666604542
                                                                                                        }
                                                                                                      }
                                                                                                    }
2022-10-26 12:35:21.371 17392-17508 Braze v23.3.0 .m3       com.poqstudio.app.elfdev             D  Result(id = c53f2424231f29d0 time = 337ms)
                                                                                                    {}
2022-10-26 12:35:21.371 17392-17508 Braze v23.....bo.app.m6 com.poqstudio.app.elfdev             D  Triggered actions Json array was null. Not de-serializing triggered actions.
2022-10-26 12:35:21.371 17392-17508 Braze v23.....bo.app.m6 com.poqstudio.app.elfdev             D  Templated message Json was null. Not de-serializing templated message.
2022-10-26 12:35:21.371 17392-17508 Braze v23.3.0 .i0       com.poqstudio.app.elfdev             D  DataSyncRequest executed successfully.
2022-10-26 12:35:21.371 17392-17508 Braze v23.3.0 .s        com.poqstudio.app.elfdev             V  Processing server response payload for user with id: email@email.la
2022-10-26 12:35:21.372 17392-17508 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  bo.app.u4 fired: RequestNetworkSuccessEvent(request={
                                                                                                      "device_id": "4f797fe7-45de-46c4-bfa1-62f5e27502e6",
                                                                                                      "time": 1666798521,
                                                                                                      "api_key": "<<my_api_key>>",
                                                                                                      "sdk_version": "23.3.0",
                                                                                                      "app_version": "22.0.8.3-67-g93164c15",
                                                                                                      "app_version_code": "1510.0.0.0",
                                                                                                      "events": [
                                                                                                        {
                                                                                                          "name": "ce",
                                                                                                          "data": {
                                                                                                            "n": "test_event"
                                                                                                          },
                                                                                                          "time": 1.666798510038E9,
                                                                                                          "user_id": "email@email.la",
                                                                                                          "session_id": "a46e8ec5-6556-481a-965e-edb090530a24"
                                                                                                        }
                                                                                                      ],
                                                                                                      "respond_with": {
                                                                                                        "user_id": "email@email.la",
                                                                                                        "config": {
                                                                                                          "config_time": 1666604542
                                                                                                        }
                                                                                                      }
                                                                                                    })
2022-10-26 12:35:21.372 17392-17508 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  Triggering bo.app.u4 on 1 subscribers.
2022-10-26 12:35:21.373 17392-17508 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  bo.app.r0 fired: DispatchSucceededEvent(request={
                                                                                                      "device_id": "4f797fe7-45de-46c4-bfa1-62f5e27502e6",
                                                                                                      "time": 1666798521,
                                                                                                      "api_key": "<<my_api_key>>",
                                                                                                      "sdk_version": "23.3.0",
                                                                                                      "app_version": "22.0.8.3-67-g93164c15",
                                                                                                      "app_version_code": "1510.0.0.0",
                                                                                                      "events": [
                                                                                                        {
                                                                                                          "name": "ce",
                                                                                                          "data": {
                                                                                                            "n": "test_event"
                                                                                                          },
                                                                                                          "time": 1.666798510038E9,
                                                                                                          "user_id": "email@email.la",
                                                                                                          "session_id": "a46e8ec5-6556-481a-965e-edb090530a24"
                                                                                                        }
                                                                                                      ],
                                                                                                      "respond_with": {
                                                                                                        "user_id": "email@email.la",
                                                                                                        "config": {
                                                                                                          "config_time": 1666604542
                                                                                                        }
                                                                                                      }
                                                                                                    })
2022-10-26 12:35:21.374 17392-17508 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  Triggering bo.app.r0 on 1 subscribers.
2022-10-26 12:35:21.374 17392-17508 Braze v23.3.0 .k0       com.poqstudio.app.elfdev             V  Notifying confirmAndUnlock listeners for cache: bo.app.k0@dfd471b
2022-10-26 12:35:21.375 17392-17508 Braze v23.3.0 .t6       com.poqstudio.app.elfdev             V  Notifying confirmAndUnlock listeners for cache: bo.app.t6@37e41f6
2022-10-26 12:35:21.376 17392-17508 Braze v23.3.0 .e5       com.poqstudio.app.elfdev             V  Attempting to unlock server config info.
2022-10-26 12:35:21.376 17392-17508 Braze v23.3.0 .e5       com.poqstudio.app.elfdev             D  Unlocking config info lock.
2022-10-26 12:35:21.376 17392-17508 Braze v23.3.0 .o5       com.poqstudio.app.elfdev             D  Deleting event from storage with uid a226c0e6-c935-49a0-bd99-e652ee4c164b
2022-10-26 12:35:51.013 17392-17553 Braze v23....eCoroutine com.poqstudio.app.elfdev             V  Requesting data flush from automatic sync policy
2022-10-26 12:35:51.015 17392-17512 Braze v23.3.0 .Braze    com.poqstudio.app.elfdev             I  Requesting immediate data flush to Braze.
2022-10-26 12:35:51.019 17392-17512 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  bo.app.o0 fired:             commandType = ADD_REQUEST
                                                                                                                brazeEvent = null
                                                                                                                sessionId = null
                                                                                                                brazeRequest = {
                                                                                                      "respond_with": {
                                                                                                        "user_id": "email@email.la",
                                                                                                        "config": {
                                                                                                          "config_time": 1666604542
                                                                                                        }
                                                                                                      }
                                                                                                    }
2022-10-26 12:35:51.019 17392-17512 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  Triggering bo.app.o0 on 1 subscribers.
2022-10-26 12:35:51.020 17392-17512 Braze v23.3.0 .q0       com.poqstudio.app.elfdev             V  Added request to dispatcher with parameters: 
                                                                                                    {
                                                                                                      "respond_with": {
                                                                                                        "user_id": "email@email.la",
                                                                                                        "config": {
                                                                                                          "config_time": 1666604542
                                                                                                        }
                                                                                                      }
                                                                                                    }
2022-10-26 12:35:51.020 17392-17553 Braze v23.3.0 .q0       com.poqstudio.app.elfdev             V  SDK Auth is disabled, not adding token to request
2022-10-26 12:35:51.026 17392-17553 Braze v23.3.0 .k0       com.poqstudio.app.elfdev             D  Cache locked successfully for export: bo.app.k0@dfd471b
2022-10-26 12:35:51.027 17392-17553 Braze v23.3.0 .t6       com.poqstudio.app.elfdev             D  Cache locked successfully for export: bo.app.t6@37e41f6
2022-10-26 12:35:51.028 17392-17553 Braze v23.3.0 .s0       com.poqstudio.app.elfdev             D  Short circuiting execution of network request and immediately marking it as succeeded.
2022-10-26 12:35:51.028 17392-17553 Braze v23.3.0 .i0       com.poqstudio.app.elfdev             D  DataSyncRequest executed successfully.
2022-10-26 12:35:51.029 17392-17553 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  bo.app.r0 fired: DispatchSucceededEvent(request={
                                                                                                      "device_id": "4f797fe7-45de-46c4-bfa1-62f5e27502e6",
                                                                                                      "time": 1666798551,
                                                                                                      "api_key": "<<my_api_key>>",
                                                                                                      "sdk_version": "23.3.0",
                                                                                                      "app_version": "22.0.8.3-67-g93164c15",
                                                                                                      "app_version_code": "1510.0.0.0",
                                                                                                      "respond_with": {
                                                                                                        "user_id": "email@email.la",
                                                                                                        "config": {
                                                                                                          "config_time": 1666604542
                                                                                                        }
                                                                                                      }
                                                                                                    })
2022-10-26 12:35:51.029 17392-17553 Braze v23.3.0 .z0       com.poqstudio.app.elfdev             D  Triggering bo.app.r0 on 1 subscribers.
2022-10-26 12:35:51.030 17392-17553 Braze v23.3.0 .k0       com.poqstudio.app.elfdev             V  Notifying confirmAndUnlock listeners for cache: bo.app.k0@dfd471b
2022-10-26 12:35:51.030 17392-17553 Braze v23.3.0 .t6       com.poqstudio.app.elfdev             V  Notifying confirmAndUnlock listeners for cache: bo.app.t6@37e41f6
2022-10-26 12:35:51.031 17392-17553 Braze v23.3.0 .e5       com.poqstudio.app.elfdev             V  Attempting to unlock server config info.
2022-10-26 12:35:51.031 17392-17553 Braze v23.3.0 .e5       com.poqstudio.app.elfdev             D  Unlocking config info lock.

Additional Information

No response

radixdev commented 2 years ago

Hi @mauro-poq ,

We are looking into this internally and will get back to you shortly.

radixdev commented 2 years ago

Hi @mauro-poq ,

Apologies for the miscommunication here, we're updating our documentation and fixing the BrazeProperties.addProperties method.

In the meantime, you can directly pass a constructed JSONObject to BrazeProperties to achieve the same use case.

val properties = BrazeProperties(JSONObject().put("testArray", JSONArray(listOf("item1", "item2", "item3"))))
Braze.getInstance(context).logCustomEvent("test_event", properties = properties)
mauro-poq commented 2 years ago

Hey @radixdev ,

Thanks, this way attend my requirements, thanks.

Shall we close this Bug?