2
votes

I am running a bot using Bot Framework + C#, deployed to Azure, connected to Facebook Messenger.

Today my code started randomly throwing this exception, in different scenarios and in response to different user inputs. I can't seem to pinpoint the exact reproducible scenario. The line that throws the exception is await context.PostAsync(message);.

SendActivityToUserAsync FAILED: {"error":{"message":"(#-1) Unexpected internal error","type":"OAuthException","code":-1,"error_subcode":2018012,"fbtrace_id":"FN44Viuxibg"}} at Microsoft.Bot.Connector.ErrorHandling.d*2`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.ConversationsExtensions.d*7.MoveNext() --- End of stack trace from previous location...

When I go through the same scenario in the bot, the error may or may not happen again. It seems completely random.

What could be the reason that facebook returns OAuthException?

1
This is a generic 500 internal server error, so my guess would be some sort of malformed or unexpected input in the body of the request. Any chance you can post the request body that's being sent to the Messenger Platform? - amuramoto

1 Answers

0
votes

I believe error_subcode 2018012 is typically caused by unicode characters not being properly encoded (utf8?). Check if your request has "exotic" characters, and try to properly escape them (urlencode).