bottender icon indicating copy to clipboard operation
bottender copied to clipboard

[Bug] - Page Token Not found

Open pavei opened this issue 6 years ago • 1 comments

I'm getting this error when one page that not have anymore my chatbot installed is sending data..


async function mapPageToAccessToken(page) {

    if (!CompanyMap.get(page)) {
        console.log("não achou item" + page)
    }

    return CompanyMap.get(page) ? CompanyMap.get(page).json.fbPageToken : null;
}



2018-11-14T15:51:15.153365850Z app[web.1]:
2018-11-14T15:51:15.153396380Z app[web.1]: Error: Messenger API - 210 OAuthException (#210) This call requires a Page access token.
2018-11-14T15:51:15.153402856Z app[web.1]:     at handleError (/app/node_modules/bottender-asksuite/node_modules/messaging-api-messenger/lib/MessengerClient.js:90:11)
2018-11-14T15:51:15.153407956Z app[web.1]:     at <anonymous>
2018-11-14T15:51:15.153412532Z app[web.1]:     at process._tickDomainCallback (internal/process/next_tick.js:208:7)
2018-11-14T15:51:15.153416744Z app[web.1]:     at process.wrappedFunction (/app/node_modules/newrelic/lib/transaction/tracer/index.js:276:51)
2018-11-14T15:51:15.153421297Z app[web.1]:
2018-11-14T15:51:15.153425248Z app[web.1]: Error Message -
2018-11-14T15:51:15.153439505Z app[web.1]:   Messenger API - 210 OAuthException (#210) This call requires a Page access token.
2018-11-14T15:51:15.153444421Z app[web.1]:
2018-11-14T15:51:15.153448588Z app[web.1]: Request -
2018-11-14T15:51:15.153452500Z app[web.1]:   GET https://graph.facebook.com/v3.0/1753925668049818?access_token=&appsecret_proof=090722f15a096bc287cd326cf1f3e6783b064c65981ba9ecaf91ded8421
2018-11-14T15:51:15.153456874Z app[web.1]:
2018-11-14T15:51:15.153460450Z app[web.1]:
2018-11-14T15:51:15.153464261Z app[web.1]: Response -
2018-11-14T15:51:15.153467930Z app[web.1]:   403 Forbidden
2018-11-14T15:51:15.153471604Z app[web.1]:
2018-11-14T15:51:15.153475123Z app[web.1]: Response Data -
2018-11-14T15:51:15.153478876Z app[web.1]:   {
2018-11-14T15:51:15.153482665Z app[web.1]:     "error": {
2018-11-14T15:51:15.153486502Z app[web.1]:       "message": "(#210) This call requires a Page access token.",
2018-11-14T15:51:15.153491042Z app[web.1]:       "type": "OAuthException",
2018-11-14T15:51:15.153494934Z app[web.1]:       "code": 210,
2018-11-14T15:51:15.153499851Z app[web.1]:       "fbtrace_id": "CCjwltZMq6f"
2018-11-14T15:51:15.153505778Z app[web.1]:     }
2018-11-14T15:51:15.153509403Z app[web.1]:   }
2018-11-14T15:51:15.153513223Z app[web.1]:
2018-11-14T15:51:15.153609410Z app[web.1]: não achou item116480255097104

pavei avatar Nov 14 '18 16:11 pavei

It seems that the page with ID 116480255097104 was using your Facebook App and it was deleted from your database so you can't mapPageToAccessToken to find an available token. When you want to disconnect a Page from your App, remember to delete subscribed_apps so Facebook knows to stop sending webhook events from that page.

At bottender side, we can make a improvement that to skip API calls when there is no token.

tw0517tw avatar Nov 20 '18 10:11 tw0517tw