How to trace the cause of a 500 internal server error? - facebook

I'm trying to do the following using FB's official PHP SDK:
$facebook->api(
'/me/feed',
'POST',
array(
'link' => 'test',
'message' => 'test'
)
)
Unfortunately, the server (not facebook!) returns a 500 error.
The request goes through, the status gets posted, but my server returns an error.
My question is, how do I find out what's the cause of it?

500 is generally "internal server error".
If you get 500 back from your facebook api call, then it might be something wrong on their end.
Then again, your HTTP requests might be a little off, and the fb server goes "um, what?" and sends you a 500 because it can't explain the problem.
I remember a number of years ago the fb api returned mostly "unknown error" codes when something went wrong - haven't touched that api since. Hopefully you're not running into the same problem.
To really solve the problem, you will need to either:
A) capture your HTTP request and response, including the headers, compare it to a successful api call, and make changes if needed.
B) capture any exceptions thrown by the facebook SDK.
Option A will always work, but option B is perhaps quicker.
Check out:
php exceptions
EDIT:
to see what is causing a 500 error on YOUR server, look in your apache error logs.
you can also use
error_reporting(E_ALL);
to rule out any php errors.

In my case i moved the application from one server to another and the missing CURL was the bug :)
In administration mode ssh i could see following line>
PHP Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.' in /srv/www/smixe.com/base_facebook.php:19

Related

Service response is a 502 Bad Gateway error with generic "Server Error" HTML block?

I wrote a Node service that takes parameters from a client and puts them into a SOAP request to another (3rd party) service. Lately, when a request is made to my service, the initial response is a 502 Bad Gateway error with a generic HTML block titled "Server Error" (see image). When I submit the same request a second time, the 3rd party responds with a 500 Internal Server error and a message indicating that a request has already been issued for that transaction.
Obviously the initial request made it to the 3rd party somehow, but they say that the 502 error isn't theirs and isn't logged in their system as ever having occurred.
What I'm trying to find out is if the error is somehow coming from my service because of Docker or Azure (or something else I'm not thinking of). The error is so generic that research hasn't yielded anything useful on it. Has anyone encountered this or know what it is?
It turns out that this was an error being thrown by Azure (or so we think) as the result of some faulty error-handling. Part of the response was being parsed incorrectly, which caused the app to stall. It still doesn't explain how the data still got to the other side while this was happening (or why it hit the catch block at all when there was no error in the processing), but if you see a server error returned with this HTML block, check your error-handling code and investigate Azure!

POST 400 and 404 (Not Fount) errors take place at the same time

When I upload file in a project, I get an error pop-up saying "invalid input syntax for integer: "2.01e+18".
And then when I check the concole, I get POST 400 and 404 (Not Found) errors.
POST https://api-staging.helloshop.com/v1/importer 400
POST http://localhost:3000/bags 404 (Not Found)
(I am using express.js by the way)
Is there any possible reason why both errors take place at the same time?.
You are making two requests, one for https://api-staging.helloshop.com/v1/importer, and one for http://localhost:3000/bags, and as result - recieving two errors.
Browser devtools also have a network tab where you can see which requests are you sending.

400 Response code on post to hubspot form

I am using a plugin on a WordPress website which is supposed to feed gravity forms submissions into hubspot however, on submission I get the following error:
PHP Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: POST https://forms.hubspot.com/uploads/form/v2/XXXXXX/97d44f1e-XXXX-XXXX-XXXX-e4c453843854 resulted in a 404 Not Found response:
I've nullified the URL.
I've searched this error and read through many, many GitHub threads but no seem of any use to me - they're all about other people's bespoke implementations. Can anybody here shed any light on this for me? Is there any more information I can post to allow anybody to help me investigate deeper?
Some temp fixes I've seen circulate:
1) On your Hubspot forms, make sure they are using Thank You messages and NOT the redirect to page feature (neither are actually functional if you are using only this plugin making API requests and not using for form embed code etc provided by HubSpot)
2) Save / update your forms in HubSpot
Since doing the above (there was a mixture of the two in our case, we have not caught any further errors for the past couple days) Jury is still out on what is the true issue behind this.
Details:
I hit this issue as well. Guzzle is throwing the error after seeing the HS response. This Guzzle client was not used in the older version of the plugin, so thinking that either the request was different in previous versions (prior to v3) or HubSpot was throwing a 404 response before and it was being ignored. Data (in my testing) is still posting correctly to the HubSpot API and shown/updated in the Contact record database. But website users end up seeing a 500 error due to this issue. (As a result the analytics scripts on the thank you page never get fired so we caught this seeing a drop in GA) I'm assuming the plugin could be coded around this to ignore the exception, but still no idea why it is being provided as a response in the first place.

500 Internal Server Error for my facebook app link

I see that this question has been asked before but no solution has been provided.
I am getting nothing but 500 Internal Server Error since yesterday when I use following link:
http://apps.facebook.com/myappID
Yes, I already tried clearing up my cache & cookies so don't even bother asking me this. I have added my app link in the Canvas URL which should show up after I click on the app URL but nothing but that 500 HTTP error. I tried on all browsers and even asked few of my friends too and they said same error.
I thought it was an error on Facebook but I don't see how it's not being fixed for a day now.
Any help? Thank you.
The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the web site's server but the server could not be more specific on what the exact problem is.
So its a "server-side" error, meaning the problem is not with your PC or Internet connection but instead is a problem with the web site's server.
Maybe you should contact facebook help center.
I just ran into a similar situation and found that when I reduced the limit in my GET call to 20 rather than 500 the server responded well.
https://graph.facebook.com/v2.0/6558867050/posts?limit=20

Facebook error: Encountered an error while processing the request: 502 Error parsing server response. Got EOF while waiting for outstanding responses

Today I started receiving errors from Facebook when my app tries to post a message.
The app successfully authorised, Facebook message window pops up, everything looks fine (links, pics, description) , but when I press post. it times out with this message
Encountered an error while processing the request: 502 Error parsing server response. Got EOF while waiting for outstanding responses Please try resending your request. This is probably not a bug in proxygen. Based on experience, either intern or latest is temporarily down due to a SEV or push. Please check in e FYI or #e first. If the error persists through retries, or if you have good reason to suspect this is a bug in proxygen, please report the issue to ti-bugs#lists or #ti with the following debug information: 2012-05-20 22:24:40 slb010.02.snc5 1585267068836963531
UPDATE: It is a Facebook issue. There is an opened and assigned bug report here You can subscribe there to follow the process.
It looks like Facebook fixed the issue. My apps work fine.
If you still experience the same problem, you can check out the progress here: http://developers.facebook.com/bugs/411849912170144?browse=search_4fb9fb43db2468a28526107
If this issue comes up again check whether there is an already submitted bug here: http://developers.facebook.com/bugs/ if there isn't submit one