botkit: Facebook Bot Webhook TypeError: Cannot read property 'length' of undefined

Node.js version: 8.4.0 Botkit version: 0.5.5

Unsure what’s going on during this event

 { object: 'page',
   entry: 
    [ { id: '<facebook-page-id>',
        time: 1510076342376,
        messaging: [Array] } ] }
     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)

Which leads to the length of undefined

TypeError: Cannot read property 'length' of undefined
     at Object.<anonymous> (/app/node_modules/botkit/lib/Facebook.js:19:54)
     at Object.Facebookbot.facebook_botkit.handleWebhookPayload (/app/node_modules/botkit/lib/Facebook.js:336:41)
     at /app/components/routes/incoming_webhooks.js:24:22
     at Object.Botkit.botkit.trigger (/app/node_modules/botkit/lib/CoreBot.js:1047:49)
     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
     at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)

I was previously using Botkit 0.5, and read in another issue that was resolved to upgrade to 0.5.1 which would resolve the issue, however upgrading to later versions still didn’t do the trick.

Would appreciate any help on this. Thanks in advance!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

@peterswimm screen shot 2017-11-08 at 7 08 21 pm

Upon investigation, it looks like when I setup a referral link on m.me/<page-id>?ref=<param> the error seems to trigger.