facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
393 stars 324 forks source link

Unable to use Facebook SDK for Conversion API requests #408

Closed galovics closed 1 year ago

galovics commented 1 year ago

Which SDK version are you using?

15.0.0

What's the issue?

The SDK cannot be used to send requests to the Conversion API due to a bug in the response processing where the code tries to upcast an APINode instance to an AdsPixel object. The fix is already in place in the main branch yet there's no bugfix release yet. The commit is this: https://github.com/facebook/facebook-java-business-sdk/commit/4cba80f973ea2396e7c1c76ca7dd558b1450f787

Since it's already fixed, I propose to create a bugfix release ASAP, otherwise the SDK is unusable to report pixel events.

Steps/Sample code to reproduce the issue

Send a regular API request to CAPI

Observed Results:

Exception occurs:

java.lang.ClassCastException: class com.facebook.ads.sdk.APINode cannot be cast to class com.facebook.ads.sdk.AdsPixel (com.facebook.ads.sdk.APINode and com.facebook.ads.sdk.AdsPixel are in unnamed module of loader 'app')
    at com.facebook.ads.sdk.serverside.EventRequest.sendToCAPIEndpoint(EventRequest.java:434) ~[facebook-java-business-sdk-15.0.0.jar:na]
    at com.facebook.ads.sdk.serverside.EventRequest.execute(EventRequest.java:401) ~[facebook-java-business-sdk-15.0.0.jar:na]

Expected Results:

Request goes to CAPI successfully.

vojkny commented 1 year ago

This happens to me as well.

williamwjs commented 1 year ago

+1 to me as well

stcheng commented 1 year ago

We are targeting a release v15.0.1.