segmentio / analytics-react-native

The hassle-free way to add analytics to your React-Native app.
https://segment.com/docs/sources/mobile/react-native/
MIT License
367 stars 191 forks source link

LogTime for Facebook SDK on Android being converted into `E` notation (exponential) #908

Closed esdrasetrenne closed 4 months ago

esdrasetrenne commented 10 months ago

This seems to be related to #878 but different...

This is only an issue for Android. "@segment/analytics-react-native-plugin-facebook-app-events": "^0.5.4",

When the log call to facebook goes out, the value for the _logTime is an exponent string where an integer is expected:

400 error for POST https://graph.facebook.com/v15.0/xxxxxx/activities
{
  "error":{
     "message":" (#100) Param custom_events[0][_logTime] must be an integer",
     "type":"OAuthException",
     "code":100,
     "fbtrace_id":"xxxxxxx",
     },
  }

I can't figure out where the logTime gets converted, but the logTime in the request body is shaped as follows:

  {
    "_eventName": "Debug_Appsflyer_init_completed",
    "_eventName_md5": "xxxxxxxxxxx",
    "_logTime": "1.704267463E9",
    "_ui": "ReactApplicationContext",
    "_session_id": "xxxxxxxxxx,
    "_appVersion": "2.0.80",
    "fb_num_items": "0.0",
    "_valueToSum": 0
  },

I did some logs in the @segment/analytics-react-native-plugin-facebook-app-events lib and the logTime is indeed a number when it is passed to the AppEvents sdk but somewhere along the line it gets converted into a string...again this is happening only on Android for us.

oscb commented 8 months ago

@esdrasetrenne Sorry for the lack of updates. Some reorgs have been impacting us.

I tried debugging this, but I notice the same as you, the library itself is handling this off to the SDK as a number. Which version of RN and FBSDK-next are you using? Given that this only happens in Android it might be related to some transformation happening over the bridge communication

esdrasetrenne commented 8 months ago

no worries about the delay, c'est la vie, hope everything is well.

lib versions: "react-native": "0.72.12" "react-native-fbsdk-next": "^12.1.3",

to be honest, I haven't tracked whether this is still happening or not, and if it turns out this is a version issue we may just wait to update.

And since this library is passing it off correctly, then maybe it's not a bug with this library? Were you seeing the same issue on android or maybe there is just something wrong with our team's configs

hvardhan-unth commented 4 months ago

Hi @esdrasetrenne Is this still an issue for you in the new version of the SDK, please confirm?

esdrasetrenne commented 4 months ago

mmm my team hasn't brought it up again, I'm not sure if we are on the latest version. We can close this out and if it comes up again I'll leave a comment

gbyesiltas commented 4 months ago

@hvardhan-unth We were also having this issue, I believe next week we will have some time to update the package, I'll leave an update here when we do 👍