facebook-java-business-sdk
facebook-java-business-sdk copied to clipboard
EventRequest returns null values when api returns error (no Exception)
Which SDK version are you using?
11.0.0
What's the issue?
If the API returns any error (error message, no Exception), EventResponse has only null values.
Steps/Sample code to reproduce the issue
Observed Results:
- What happened? This could be a description, log output, etc.
- Create EventRequest with valid pixel id, but with invalid access token
String fbCAPIToken = INVALID_TOKEN
String fbPixelId = VALID_PIXEL_ID
APIContext context = new APIContext(fbCAPIToken).enableDebug(true);
context.setLogger(System.out);
...
EventResponse asyncResponse = new EventResponse();
try {
final ListenableFuture<EventResponse> requestFuture = eventRequest.executeAsync();
asyncResponse = requestFuture.get();
log.info(String.format("FB Standard API response : %s ", asyncResponse.toString()));
} catch (APIException e) {
log.error("[FACEBOOK-CONVERSION-API-SERVICE][" + e.getClass().getName() + "]", e);
} catch (InterruptedException e) {
log.error("[FACEBOOK-CONVERSION-API-SERVICE][" + e.getClass().getName() + "]", e);
} catch (ExecutionException e) {
log.error("[FACEBOOK-CONVERSION-API-SERVICE][" + e.getClass().getName() + "]", e);
}
- Dumped to system log:
15:44:08,117 INFO [stdout] (default task-7) ========Start of Async API Call========
15:44:21,156 INFO [stdout] (OkHttp https://graph.facebook.com/...) Response:
15:44:21,157 INFO [stdout] (OkHttp https://graph.facebook.com/...) {"error":{"message":"Invalid OAuth access token.","type":"OAuthException","code":190,"fbtrace_id":"AC5D9WUaWZDy-4cgD3ll0qC"}}
15:44:21,157 INFO [stdout] (OkHttp https://graph.facebook.com/...) ========End of API Call========
15:44:21,276 INFO [stdout] (OkHttp https://graph.facebook.com/...) [Warning] When parsing response, object is not consistent with JSON:
15:44:21,277 INFO [stdout] (OkHttp https://graph.facebook.com/...) [JSON]{"error":{"message":"Invalid OAuth access token.","type":"OAuthException","code":190,"fbtrace_id":"AC5D9WUaWZDy-4cgD3ll0qC"}}
15:44:21,277 INFO [stdout] (OkHttp https://graph.facebook.com/...) [Object]{}
15:44:21,277 INFO [stdout] (OkHttp https://graph.facebook.com/...) Successfully sent null event(s)
- Received:
EventResponse {
eventsReceived: null
messages: null
fbTraceId: null
}
Expected Results:
- What did you expect to happen?
Response with error fields (at least message field)
{"error":{"message":"Invalid OAuth access token.","type":"OAuthException","code":190,"fbtrace_id":"AC5D9WUaWZDy-4cgD3ll0qC"}}
ping
ping
We are facing the same issue. Any plan to fix it in the nearest future?