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

Client is unable to parse response from FB - "Invalid JSON string" #289

Open
Logrythmik opened this issue Feb 27, 2014 · 4 comments
Open
Assignees

Comments

@Logrythmik
Copy link

We just started receiving the following exception in production:

"Type": "SerializationException",
"Message": "Invalid JSON string",
"Source": "Facebook",
"StackTrace": "   at Facebook.SimpleJson.DeserializeObject(String json)\r\n   at Facebook.SimpleJson.DeserializeObject(String json, Type type, IJsonSerializerStrategy jsonSerializerStrategy)\r\n   at Facebook.SimpleJson.DeserializeObject(String json, Type type)\r\n   at Facebook.FacebookClient.ProcessResponse(HttpHelper httpHelper, String responseString, Type resultType, Boolean containsEtag, IList`1 batchEtags)\r\n   at Facebook.FacebookClient.Api(HttpMethod httpMethod, String path, Object parameters, Type resultType)\r\n   at Facebook.FacebookClient.Post(String path, Object parameters)\r\n   at ... ",

This occurs during the following call:

 var result = fbClient.Post(path, post);

The problem seems to occur with the result coming back from Facebook, after a successful post. Did Facebook change their API response? Looking for an updated version that can handle the response correctly.

@prabirshrestha
Copy link
Member

@Logrythmik can you paste the path and post too. Which version of the SDK are you using?

Also would suggest you to look at the fiddler.

Is this happening randomly or always?

@ajorkowski
Copy link

Seems to be a bug from Facebook - returning a null value back instead of the id. The cause seems to be an 'Expect 100-continue' header. Does the client send this header?

https://developers.facebook.com/x/bugs/1445900518978580/

@Logrythmik
Copy link
Author

Nuget Version: 6.4.2
File version: 6.0.10.0

----- full source-----
var path = string.Format("{0}/feed", fbAccount.Id);
var resultId = string.Empty;
dynamic post = new ExpandoObject();
post.message = content.Message;
var result = fbClient.Post(path, post);
resultId = result.id;

It is happening with every post (it seems). I could reproduce it with a super simple example.

@prabirshrestha
Copy link
Member

While FB is sending out a new build for the fix. Can you disabling it by the following code before you run any FB C# SDK codes.

System.Net.ServicePointManager.Expect100Continue = false;

FB C# SDK uses the default value set by HttpWebRequest which is true.

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

No branches or pull requests

5 participants