Rob Rob - 1 year ago 114
Node.js Question

NodeJS Azure Functions used as a Messenger Bot return an mscorlib error

I'm trying to use Azure Functions as a Messenger bot server using a Generic Webhook. The problem I'm running into is that even running this simple code (most of it is commented out to try & figure out the issue) results in an error (below the code):

module.exports = function (context, data) {
context.log('Webhook was triggered!');

context.res = {
status: 403,
body: ''


Function completed (Failure,
Exception while executing function: Functions.StriverMessenger.
mscorlib: The given key was not present in the dictionary.

Why is this error occurring and how do I get this to work? If I fake out the querystring entries in the run mode inside Azure, the function appears to work as coded. The error occurs when trying to send a Verify request to the Azure Function from Facebook Developer, specifically in Messenger's Webhook setup.

Answer Source

This happens when an empty (or non-json) body is sent to a Function with type WebHook. The handling is poor, and we are improving it per This should be deployed within a week and you can then verify.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download