pimax/fb-messenger-php

HTTP/1.1" 500 73433 "-" "-"

Closed this issue · 14 comments

So the application works fine on DigitalOcean, but when I moved it to AWS it does not respond. I checked the access.log and it return HTTP/1.1" 500. the webhook returned 200 with no problem.

I also printed the requested data in the error log using php_log() and I got full data with no issues but it does not send back to facebook any response.

Apparently it's throwing error HTTP/1.1" 500. Can this be php module need to be enable ? waht are the necessary apache/php modules need to be enabled ?

seems like the error happened on send()

This sounds like an curl problem.
Perhaps the function must be activated or installed?

Curl installed and enabled.

Any error messanges?

Both of the server has same enabled module

it doesn't work here:

Array ( [0] => core [1] => mod_so [2] => mod_watchdog [3] => http_core [4] => mod_log_config [5] => mod_logio [6] => mod_version [7] => mod_unixd [8] => mod_access_compat [9] => mod_alias [10] => mod_auth_basic [11] => mod_authn_core [12] => mod_authn_file [13] => mod_authz_core [14] => mod_authz_host [15] => mod_authz_user [16] => mod_autoindex [17] => mod_deflate [18] => mod_dir [19] => mod_env [20] => mod_filter [21] => mod_mime [22] => prefork [23] => mod_negotiation [24] => mod_php7 [25] => mod_rewrite [26] => mod_setenvif [27] => mod_socache_shmcb [28] => mod_ssl [29] => mod_status )

This is the working server:
Array ( [0] => core [1] => mod_so [2] => mod_watchdog [3] => http_core [4] => mod_log_config [5] => mod_logio [6] => mod_version [7] => mod_unixd [8] => mod_access_compat [9] => mod_alias [10] => mod_auth_basic [11] => mod_authn_core [12] => mod_authn_file [13] => mod_authz_core [14] => mod_authz_host [15] => mod_authz_user [16] => mod_autoindex [17] => mod_deflate [18] => mod_dir [19] => mod_env [20] => mod_filter [21] => mod_mime [22] => prefork [23] => mod_negotiation [24] => mod_php5 [25] => mod_rewrite [26] => mod_setenvif [27] => mod_socache_shmcb [28] => mod_ssl [29] => mod_status )
I can't see errors, however I see 500 on access.log. I am using the example from your other repository as is, so no custom code from myside.

I think you have to change the settings in the facebook settings page.

66.220.152.174 - - [06/May/2017:14:09:10 +0000] "POST /app.php/page/1635969484 HTTP/1.1" 500 73433 "-" "-"

I think facebook is doing their part, they post to my server each time I write something on the messenger. But they get 500.

What about the AWS IAM policies?

It's all good about the instance policies. I just noticed an error Notice: Undefined index: is_echo , I commented
// skip the echo of my own messages //if (($message['message']['is_echo'] == "true")) { // continue; //}

and then I start getting status 200. However It still does not send response to messenger bot

and this is all what I get in the message $data['entry'][0]['messaging'][''message]:
"message":{"mid":"mid.$cAAW2YnnVGjJiECQtN1b3t7lBq3fn","seq":261077,"text":"generic"}

This is the Echo, you should skip

I adjusted the code and now I am getting status 200. But, I still don't get response back to the messanger
// skip the echo of my own messages if(!empty($message['message']['is_echo'])){ if ($message['message']['is_echo'] == "true") { continue; } }

Okay @wittfabian Thank you for helping here.
So I managed to fix this. The main issue again was $message['message']['is_echo'] is not defined , for some reason it was working on one server but the other after I added if(!empty($message['message']['is_echo'])){ } before checking the value then everything start working good.

// skip the echo of my own messages
if(!empty($message['message']['is_echo'])){
if ($message['message']['is_echo'] == "true") {
continue;
}
}

Interesting.