Heroku - Application Error, but no error in logs - facebook

I'm hacking away at a Facebook app on Heroku, using Node.js. When I go to the app myself, it works exactly as I expect. When I send another developer/tester to it, the standard Heroku "Application Error" message is displayed. When I check the logs, there isn't even a log that the developer made a GET request for the app page, let alone an error.
He tells me that the last thing he sees in his browser status bar is "waiting for .herokuapp.com", which implies that Facebook got to the app, but the logs don't support this theory.
Is there another method of seeing Heroku errors? Is there something I have to turn on in order to see more? A setting I have to modify to let this other guy use the app?
Update: Some more looking around led me to check the network traffic. He's getting a 503 Service Unavailable, followed by the error page. Still wondering why this happens on his machine, but not mine.
Update: Inserted some error-checking code into the handle_facebook_request method.
req.facebook.app(function(err, app) {
if(err !== null) {
var errorMessage = "Error getting app: " + util.inspect(err['error']);
console.log(errorMessage);
}
// rest of req.facebook.me, and rendering code
}
This gives me an "Unsupported get request", of type "GraphMethodException" and code 100. So now I have something I can look into! I wish that Heroku had at least mentioned that the request had been tried.

I had the same problem with a new facebook app created with the support heroku / node.js.
After several attempts and tests I saw that I get the message "Unsupported get request", type "GraphMethodException" and the code 100, because my facebook app was with sandbox mode.
When I disabled the sandbox my application on heroku it worked fine.

Related

Facebook login WinJS Store app issues

I tried following this blog post
Which explains how to setup up facebook login on a WinJS app.
I got it all working, got the app ids set and the authentication dialog is showing the correct app name and authentication stuff, however when the app redirects the app receives this error (after closing the dialog: "The specified protocol is unknown") and the dialog shows the error message: "We can't connect to the service you need right now. Check your network connection or try this again later".
the error stack:
"WinRTError: The specified protocol is unknown.\r\n\n at getResultsOfAsyncOp (Function code:338:5)\n at op.completed (Function code:427:21)
Actual calling code:
var loginURL = "https://www.facebook.com/dialog/oauth?client_id=[snip]&display=popup&scope=user_about_me&response_type=token&redirect_uri=ms-app://s-[snip]/"
Windows.Security.Authentication.Web.WebAuthenticationBroker.authenticateAsync(
Windows.Security.Authentication.Web.WebAuthenticationOptions.none,
new Windows.Foundation.Uri(loginURL))
.then(function success(result) {
}, function error(error) {
});
Hopefully anyone here has any idea why this error message is thrown.
We managed to solve the issue.
The sid from the store was different from the sid of the app during local debugging. By changing the appmanifest -> packaging -> publisher certificate to a local certificate with the CN provided in the store settings the sid is updated to be equal to the one in the store.
et voila, it works.

Why does Facebook Graph API return error "An unexpected error has occurred. Please retry your request later."?

My iOS app was working perfectly with Facebook SDK until today I started to get this weird error:
body = {
error = {
code = 2;
message = "An unexpected error has occurred. Please retry your request later.";
type = OAuthException;
};
};
code = 500;
I am trying to do an FQL query and I haven't changed a single line of code. My access token is valid. Moreover, I went to Graph API Explorer, tried the exactly same FQL query from the Graph API Explorer (with the Application set to Graph API Explorer, and it worked. In Graph API Explorer, I've changed the Application to my app, and I got this error again, eliminating the possibility of the cause of my problem being the iOS SDK or access token. I've tried some of my other apps and they also work. The error seems to be bound to my app, but there is nothing wrong (or changed within a day, which used to work without a problem) with my app too in apps section. What could be the cause of this error?
This was probably a temporary issue. After writing the question, I tried the API call again, and it worked.

AgileToolkit OAuth add-on error 500 at facebook's mobile site

I am using the OAuth Facebook controller add-on for ATK4.
It works as expected when authenticating with Facebook from a regular desktop browser.
It works when authenticating using a mobile browser that is telling face book that it's a desktop browser.
It does not work when Facebook detects a mobile browser and redirects to m.facebook.com/dialog/oath.
What's more, is that it works fine for signups from mobile browsers (ie, when Facebook asks the user to give permission to the app).
The login flow stops with an Error 500 at:
https://m.facebook.com/dialog/oauth?redirect_uri={my_url_encoded_landing_page_where_the_OAuth_controller_lives}&scope=email&client_id={fb_app_id}
What the hell is going on here? There isn't some difference between the Facebook mobile service and the regular one that the addon isn't taking care of, or is there?
It must be something I'm doing wrong. In init() on the page that handles the FB, I am doing the following:
function init(){
parent::init();
$f = $this->add("oauth/Controller_OAuth_Facebook", array('sign_method'=>'PLAINTEXT'));
if ($fbtoken = $f->check()) {
$f->setSignatureInfo();
$f->setAuthToken($fbtoken["access_token"], $fbtoken["expires"]);
$s = $this->add("sni/Controller_SNI_Facebook");
$s->setOAuth($f);
// ...
// grab profile from SNI, database lookup, session stuff, etc
// ...
}
}
I've tried all three sign_methods, and tried leaving it alone, but that doesn't make much difference because the user is not making it back to the controller with an access token to use anyway.
I tried creating a new app with Facebook and I get the same issues with a basically vanilla configuration on that. I've only marked and specified the "Website with Facebook Login" site URL integration.
The image below was captured from Chrome after overriding the user agent to a mobile device to trigger the forward to facebook's mobile servers:
Screen shot of request
Facebook closed my bug report with them stating that it's not an issue since no one else is reporting the bug. I am removing the ATK4 tag, as I get the same issue using the example PHP code provided by Facebook on GIT.
Created dedicated example here:
http://demo.ambienttech.lv/d.html?ns=d3
Example is downloadable and includes instructions of setting up facebook app as well. See if that helps.
Try This:
<?php
class page_fb extends Page {
function init(){
parent::init();
$f = $this->add("oauth/Controller_OAuth_Facebook");
$fbtoken = $this->api->recall("fbtoken");
if ($m = $_GET["error_msg"]){
$v=$this->add("View_Error");
$v->add("Text")->setHTML("You can't connect to the application.");
$v->add("Button")->setHTML("Try again")->js("click", $this->js()->univ()->location("fb"));
return;
}
if (!$fbtoken){
if ($fbtoken = $f->check("email")){
$this->api->memorize("fbtoken", $fbtoken);
$this->api->redirect($this->api->url("/index"));
}
} else {
$f->setSignatureInfo();
$f->setAuthToken($fbtoken["access_token"], $fbtoken["expires"]);
$c = $this->add("sni/Controller_SNI_Facebook");
$c->setOAuth($f);
if (!$this->api->recall("fbuserinfo")){
$this->api->memorize("fbuserinfo", $c->getUserProfile());
}
$info = $this->api->recall("fbuserinfo");
$username = $info->username;
$img = $c->customRequest("/" . $username . "/picture?type=large");
$this->api->memorize("userimg", $img);
$this->api->memorize("userinfo", $info);
if (!$this->api->auth->isLoggedIn()){
$this->api->auth->login($info->email);
}
$this->api->redirect($this->api->url("/index"));
}
}
}
I've got the same problem, but using PHP: just using a mobile web browser is not working, giving '500 internal server error'.
I'm just asking myself if exists a parameter for the method getLoginUrl to force return a non-mobile version of the authentication page...
I reported this issue here: https://github.com/atk4/atk4-addons/issues/35
Please stay tuned and if you can, you can always make changes yourself and pull request.
I can't test and fix this because strangely I still don't have smart phone :(
Something changed in FB's mobile OAuth service that is causing the error. I ran a test with my code base on a shorter URL (ie; http://domain.net/fb/ rather than http://development.project.domain.net/fb) and it works fine. I am not entirely sure of what exactly is causing the problem as Facebook refuses to acknowledge the issue as being on their server, but I have a few possible culprits that may be triggering the error on their side, but since they don't care, I don't either, and I am providing my results for anyone else who encounters this bs.
The environment I am developing in uses semi-complex (apparently) naming scheme. The development server has its own hostname under a subdomain. The issue may be caused by the fact that there are multiple components to the host portion of the URL or simply too many characters.
The name servers for the development environment are provided by DynDNS. Facebook's mobile OAuth service may be choking on the idea of a development site being hosted on a non-permanent IP address.
I'm not going to do anymore testing on this because it really is a problem with Facebook, not my code or servers, and it will work in production.

CocoaSoundCloudAPI crashes when I connect to company FaceBook account. Fix required

(I've previously tried SoundCloud GoogleGroups (defunct?), and directly to my SoundCloud contact for this. Told to post the issue here.)
Just trying to get to grips with SoundCloudAPI on iOS and I found a nasty error. Either this is a bug in the API, or a bug in SoundCloud, or (most likely) I'm doing something wrong. :) But the end result would be a broken app, so I'm keen to understand what is going wrong here.
I set up a new iOS project, following the Tobias video, and the CocoaSoundCloudAPI readme.
Using theSCShareViewController I connect to a test SoundCloud account I made for my company. I then create a new connection within the app to a test company FaceBook account. I click install, and Allow All permissions.
The app then hangs, with Terminating app due to uncaught exception 'NSInvalidArgumentException'
on the line (in SCRecordingSaveViewController.m) :
cell.textLabel.text = [connection objectForKey:#"display_name"];
Whenever I run the app now, it crashes on this line.
When I dump out the contents of the connection NSDictionary, it looks like there are two connections listed in self.availableConnections, a "facebook_page" connection with the display_name I gave for my company FaceBook page. But also a second "facebook_profile" with a null display_name. It's this second connection that is causing the API to crash. Presumably the API developers were never expecting a null display_name, but also I don't understand why it's listing two FaceBook connections at all.
If I investigate the value of "display_name" further then Xcode tells me "Variable is not a CFString" and indeed if I look at the class then it is not.
Going into SoundCloud in a browser, I can list the connections, and it shows two of them. One with the name of my company FB account, and a second one:
"http://facebook.com/profile.php?id=***** is your primary Facebook user account"
If I disconnect both of these I can use the SoundCloudAPI again without it crashing.
I then created new personal test SoundCloud and FaceBook accounts, and did the same thing again within the app. This time it did not crash (and in fact worked great), and the connection NSDictionary has one connection "facebook_profile" with a valid display_name. SoundCloud via a browser also lists just one connection.
Note that this also happens with CocoaSoundCloudDemo with no code changes.
I can also hack around with the code to avoid crashing when connecting to my company account:-
// cell.textLabel.text = [connection objectForKey:#"display_name"];
id displayName = [connection objectForKey:#"display_name"];
if ([displayName isKindOfClass:[NSString class]])
{
cell.textLabel.text = (NSString*)displayName;
}
...which gives me two rows with FB connections, but the second is blank. With some effort I can work out what they are doing here in the code, and not show a row if the display_name is invalid, but obviously I'd rather not have to do that and use the standard API code.
SO, long story short:-
1) Does SoundCloud allow you to connect to a company FaceBook account? Is there some special setup you need to do on that FaceBook account so that SoundCloud only sees the "Facebook_profile" and not also "Facebook_page"? The problem seems to be within SoundCloud itself, and not the iOS API, but it is the API that crashes.
2) From my test app, if a user tries to connect a SoundCloud account to a company FaceBook account (at least, with the minimal setup that I have in mine), then the SoundCloudAPI will crash with an exception, and my entire app will continue to crash until the user logs on with a browser to SoundCloud and removes the two connections manually. Surely this can't be good, but I've Googled for anyone with a similar issue and found nothing. Without finding a fix for this I can't use the full API in my app for fear my users will hit the same crash bug, and perhaps will have to create a cut-down custom UI that avoids the need to share to FaceBook etc.
sorry that we have not come back to you earlier.
It is always good to receive feedback from our SDK users and yes we should check
against nil values and handle this case accordingly.
However, I investigated the situation you are describing and actually it worked
flawlessly for me. Two rows for Facebook were displayed properly as soon as I
connected my SoundCloud account w/ the new Facebook page in my SoundCloud profile settings.
You can also check which accounts are connected by running
curl "https://api.soundcloud.com/me/connections.json?oauth_token=<YOUR_OAUTH_TOKEN>
In my case I received something like this
{
"kind": "connection",
"id": 12345678,
"created_at": "2013/01/10 15:55:20 +0000",
"display_name": "Testpage",
"post_publish": true,
"post_favorite": true,
"type": "facebook_page",
"service": "facebook_page",
"uri": "https://api.soundcloud.com/connections/12345678"
},
{
"kind": "connection",
"id": 12345679,
"created_at": "2013/01/10 11:07:56 +0000",
"display_name": "Rob",
"post_publish": true,
"post_favorite": true,
"type": "facebook_profile",
"service": "facebook_profile",
"uri": "https://api.soundcloud.com/connections/12345679"
}
So while uploading a new sound via the SDK, I got two Facebook rows in
the sharing section. Are you still experiencing this issue?
We will release an update to our iOS SDK soon, so stay tuned and thanks for your feedback.

iphone twitter and sharing

Has anyone encountered the following error message when sending to Twitter?
"Error: Incorrect signature"
And on the debug console:
<0xf14cf80 SHKTwitter.m:(356)> Twitter Send Status Error: {"request":"\/1\/statuses\/update.json","error":"Incorrect signature"}
So far as I can tell I've followed the install instructions on http://www.getsharekit.com/install/#download and it is working with Facebook, e-mail etc. just not Twitter.
It would be great if someone has seen this error before and goes "aha!".
All I did to enable twitter Sharing is:
Regitered my App as a Twitter APP (Application Type: Browser)
#define SHKTwitterConsumerKey #"My..."
#define SHKTwitterSecret #"My..."
#define SHKTwitterCallbackUrl #"http://www.anything.com/callback" // You need to set this if using OAuth, see note above (xAuth users can skip it)
\#define SHKTwitterUseXAuth 0 // To use xAuth, set to 1
\#define SHKTwitterUsername #"" // Enter your app's twitter account if you'dlike to ask the user to follow it when logging in. (Only for xAuth)
Note that for the callback function you can enter any URL you want. even www.google.com. Just make sure it is the same URL in your code.
The issue is that you're signed into your twitter account, and allowed the app to connect to your profile.
However, days go by, the Key and Secret change, and now you're seeing this error. It's because you have to log out and re-log back into Twitter. I spent waaay too much time finding this out when I created a new Twitter App to hook into (and organize my apps) and found this error.
Basically, ShareKit is saving your login info, auto-logging you in, and getting the error when twitter says the app doesn't have permission to connect to your profile.
Follow these steps to log yourself out and test again :
http://www.getsharekit.com/docs/#logout
Check this previous SO question, it might be able to help you solve the problem:
Twitter API status update always returns "Incorrect signature"