adobe / aepsdk-react-native

A wrapper around the iOS and Android AEP mobile SDK to allow for integration with React Native applications.
Apache License 2.0
15 stars 28 forks source link

Edge.sendEvent callback doesn't deliver all information #143

Closed mdonke closed 2 years ago

mdonke commented 2 years ago

I'm having issues extracting the Edge Tracking Response in my RN code. While native code receives the data correctly, the Edge.sendEvent callback in RN does not give all information.

Expected Behaviour

Edge Tracking Event response is available in RN code

Actual Behaviour

Cropped response

[{"type":"activation:pull","payload":[{"destinationId":"XXX","type":"profileLookup","alias":"XXX"}]}]

Steps to Reproduce

  1. Define an Edge Segment which qualifies if below event is fired
  2. Ingest an experience event from the app
  3. Extract response

Platform and Version

Android @adobe/react-native-aepedge@1.0.0-beta.1

Sample Code that illustrates the problem

    Edge.sendEvent(experienceEvent).then(function (value) {
      console.log("event response:" + JSON.stringify(value))

Logs taken while reproducing problem

Looking at adb logcat I can see the expected response coming. (Look at "segments" below)

02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK: Edge - NetworkResponseHandler - Received server response:
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK: {
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:   "requestId": "d68d1e17-a119-4cb4-8e74-b6c12152d2ba",
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:   "handle": [
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:     {
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:       "payload": [
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:         {
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:           "type": "profileLookup",
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:           "destinationId": "XXX",
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:           "alias": "XXXX",
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:           "segments": [
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:             {
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:               "id": "54617704-6afc-42c8-8be5-4255a03cd6b9"
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:             },
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:             {
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:               "id": "88122b80-8081-4caa-9e46-b9bc0d021857"
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:             }
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:           ]
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:         }
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:       ],
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:       "type": "activation:pull",
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:       "eventIndex": 0
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:     }
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK:   ]
02-16 10:34:11.831 15800 15893 D AdobeExperienceSDK: }
mdonke commented 2 years ago

The issue is located in RCTAEPEdgeMapUtil where you don't handle the incoming (weird) ArrayList/HashMap data structure for "segments".

Can you please fix this?

I didn't check iOS. Maybe there is the same issue.

cacheung commented 2 years ago

@mdonke, thanks for reporting. We will look into it.

Calise Cheung Mobile Engineer

cacheung commented 2 years ago

Hi @mdonke, We narrowed down the issue for Android platform and working on a fix. iOS has different implementation, could you check iOS and let us know if you see the issue there with the same response?

Thanks, Calise Cheung Mobile Engineer

mdonke commented 2 years ago

Yes, just verified: its working fine on iOS.

cacheung commented 2 years ago

@mdonke Thanks for confirming on iOS.

Thanks, Calise

cacheung commented 2 years ago

Hi @mdonke, @adobe/react-native-aepedge@1.0.0-beta.2 is released which addresses this issue.
Please let us know if it resolves the problem.

Thanks, Calise

cacheung commented 2 years ago

Hi @mdonke, have you got chance to try the beta.2 and see the issue is resolved?

cacheung commented 2 years ago

Closing this for now, you can open a new ticket if still see the issue.

mdonke commented 2 years ago

Upgraded to 1.0.0 and I confirm its working now. Thanks for your efforts!