Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException while reading the response #208

Closed
srinivasgiduthuri opened this issue Nov 26, 2018 · 12 comments
Closed

NullPointerException while reading the response #208

srinivasgiduthuri opened this issue Nov 26, 2018 · 12 comments

Comments

@srinivasgiduthuri
Copy link

Hello team,

We are getting the following exception occasionally. Could you please let us know the reason and how to avoid these errors? We are using Facebook Ads API 3.2.0.

java.lang.NullPointerException
at java.io.Reader.(Reader.java:78)
at java.io.InputStreamReader.(InputStreamReader.java:72)
at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:296)
at com.facebook.ads.sdk.APIRequest.access$100(APIRequest.java:53)
at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.sendGet(APIRequest.java:524)
at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.execute(APIRequest.java:508)
at com.facebook.ads.sdk.APIRequest.executeInternal(APIRequest.java:197)
at com.facebook.ads.sdk.AdAccount$APIRequestGetCustomAudiences.execute(AdAccount.java:10129)
at com.facebook.ads.sdk.AdAccount$APIRequestGetCustomAudiences.execute(AdAccount.java:10124)
at com.facebook.ads.sdk.AdAccount$APIRequestGetCustomAudiences.execute(AdAccount.java:10100)

@jingping2015
Copy link
Contributor

Hi, Thanks for reporting this bug. Can you please also try to make the same call with graph API, is there any error be throw ?

@srinivasgiduthuri
Copy link
Author

Hi, Thanks for reporting this bug. Can you please also try to make the same call with graph API, is there any error be throw?

I have tried the Graph API from the browser, it is not throwing the exception. But, the above exception coming intermittently.

@srinivasgiduthuri
Copy link
Author

Hi, Thanks for reporting this bug. Can you please also try to make the same call with graph API, is there any error be throw?

I have tried the Graph API from the browser, it is not throwing the exception. But, the above exception coming intermittently.

@jingping2015 Could you please let me know what can we do here?

@srinivasgiduthuri
Copy link
Author

@jingping2015 any update on this?

@jingping2015
Copy link
Contributor

Hi, did you tried with another ad account ID to make the api call ? Are they all throw the same error ?

@srinivasgiduthuri
Copy link
Author

Hi, did you tried with another ad account ID to make the api call ? Are they all throw the same error ?

The issue is intermittent. Not occurring all the times. Is there anything we can do?

@jingping2015
Copy link
Contributor

If you get the error again, could you please paste the fbtrace_id in the response here ?

@srinivasgiduthuri
Copy link
Author

If you get the error again, could you please paste the fbtrace_id in the response here ?

Sure. But the fbtrace_id also will not get printed during this exception as we are getting the exception while reading the response itself. Please suggest any other way if one is available.

@nayakravi
Copy link

We started seeing this same issue a few days ago - but now it is occurring consistently across all our apps that use the java sdk - we were using 3.1.0 and now upgraded to 3.1.2 - but same result. The relevant stack trace we see is (on v3.1.2):
Caused by: java.lang.NullPointerException
at java.base/java.io.Reader.(Reader.java:167)
at java.base/java.io.InputStreamReader.(InputStreamReader.java:72)
at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:296)
at com.facebook.ads.sdk.APIRequest.access$100(APIRequest.java:53)
at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.sendGet(APIRequest.java:524)
at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.execute(APIRequest.java:508)
at com.facebook.ads.sdk.APIRequest.executeInternal(APIRequest.java:197)
at com.facebook.ads.sdk.AdAccount$APIRequestGetCustomAudiences.execute(AdAccount.java:10097)
at com.facebook.ads.sdk.AdAccount$APIRequestGetCustomAudiences.execute(AdAccount.java:10092)

@nayakravi
Copy link

like @srinivasgiduthuri indicated - the facebook API call gets executed successfully. The bug is in the response parsing code in the SDK. Also the code at APIRequest.java:296 is executed within the exception handler in the readResponse method and encounters a null pointer exception - that masks the original exception. I cannot reproduce this bug locally - only happens in our cloud deployed code - which makes this harder to reproduce without modifying the library source and putting some diagnostic code in. We will do this as a last resort, but will appreciate it if you can provide any pointers @jingping2015.

@kevinwenzhang
Copy link

We have this exact same issue. We've deployed a Spring Boot application in Google Cloud and we keep getting these NPEs whenever the application starts up. It runs without any issues locally, and I've confirmed the exact same requests return results in the Graph Explorer.

@nayakravi , @srinivasgiduthuri, @jingping2015 - Was this problem ever resolved?

@mariussoutier
Copy link

mariussoutier commented Mar 9, 2021

Facing the same issue with certain ad accounts, while others do work.

Update: I could resolve this by avoiding parallelism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants