Open balazsorban44 opened 5 years ago
Hey @balazsorban44, I've actually never encountered this error myself, but since this error is thrown when your bot tries to verify that the request comes from Facebook, you can probably bypass the verification locally while you test it.
It's been a while since I've worked with this project, but one thing I can suggest is changing line 36 in BootBot.js from:
this.app.use(this.webhook, bodyParser.json({ verify: this._verifyRequestSignature.bind(this) }));
to:
this.app.use(this.webhook, bodyParser.json());
If that works, then we can probably make it an option in the bot's config object so that you can specify that you want to skip the signature verification when running it locally.
Let me know how that goes!
This is because your JSON is not being propery parsed. Body parser worked for me perfectly . example const bodyParser = require("body-parser"), app = express().use(bodyParser.json());
It is not the first issue related to this problem (see #14 #40 #48 #66 #67 #69 #84 #110), but as I see that most of them ended up being closed without a solution, I was thinking of opening it again, with some extra thoughts. So I searched the Internet, and the most possible source of the problem is here:
https://github.com/Charca/bootbot/blob/8884e72403ced1bcf5615645251968640b7c3936/lib/BootBot.js#L681-L698
On another repo, some people claim they solved the problem: https://github.com/botmasterai/botmaster-messenger/issues/15#issuecomment-414714190
I am just curious if the following has been considered when the
_verifyRequestSignature
function was created?:If not, maybe this might be helpful?:
UPDATE: Playing with it on a fork locally, I found out, that the Error that gets triggered is on line 684 in
BootBot.js
, cause signature isundefined
. Now I am not an expert on this topic, so maybe is it me, who should send anX-Hub-Signature
? I am testing with curl:Clearly, there is no x-hub header, not even in Facebook's example!
What I tried is to change the code on line 36 https://github.com/Charca/bootbot/blob/8884e72403ced1bcf5615645251968640b7c3936/lib/BootBot.js#L36
to this (using x-hub-signature from npm):
By doing that, I now actually get a different error:
Which at least describes the problem a bit better. So at the end of the day, I still have the same problem, so if you can and could help me to explain what X-Hub-Signature's value should be, I would appreciate it!
Without this, I don't know how to develop/test locally, and I have to deploy every time I make a small change to test.
@Charca ?