Publishing simple NodeJs BotConnector example fails
Hi,
I've been eagerly attempting to get a very simple bot to work with the bot framework since I saw the keynote. While getting the bots to work locally is fairly straight forward, I can't seem to get them functioning in the cloud.
I've been playing around with the NodeJs framework - and I basically started mimicking the simple botConnector example: https://github.com/Microsoft/BotBuilder/blob/master/Node/examples/hello-BotConnectorBot/app.js
However, it fails with a 500 and no further information.
From what I can gather it throws an error in the processMessage function and hits the catch statement.
(I tried deploying both to azure, google app engine and heroku - all with the same result)
{
"error": {
"code": "ServiceError",
"message": "*Sorry, CvrBot isn't available right now.*",
"statusCode": 500
}
}
I'm really excited to get this up and running :)
What is your bot id (appId) ?
Also, does it work with the emulator? ( http://aka.ms/bf-bc-emulator )
Similar issue. I get a 403 if accessing the botbuilder using the botframework.com botconnector. I think the issue lies within BotConnectorBot.js @ line 39 - 43
if (req.headers && req.headers.hasOwnProperty('authorization')) {
var tmp = req.headers['authorization'].split(' ');
var buf = new Buffer(tmp[1], 'base64');
var cred = buf.toString().split(':');
if (cred[0] == _this.options.appId && cred[1] == _this.options.appSecret) {
I can use my bot with no issues at all when using the emulator because the emulator sends a different header than the botframework.com botconnector and BotConnectorBot.js cannot find the "authorization" header in the message from the botconnector
Emulator
{ authorization: 'Basic QWxleFJhc3BiFmYWFkOA==',
'content-type': 'application/json; charset=utf-8',
host: 'alexamin.de',
'content-length': '1441',
expect: '100-continue' }
Botframework.com botconnector
{ 'x-correlating-operationid': 'syn24nvZHgU=fgtEjkT3aCTepT+wIU=',
'content-type': 'application/json; charset=utf-8',
host: 'alexamin.de',
'content-length': '1077',
expect: '100-continue' }
Could this be the issue?
Are you registering an https endpoint? We only send the auth headers when using HTTPS, because otherwise we would be exposing your secret. But your code is still checking for the basic auth. Either remove basic auth (if you want an unsecure bot) or add register as HTTPS.
I switched my server to https, now i have the authorization header but also get nothing but a 403 & "Sorry Bot isn't available right now". Still works in the emulator though!
*Correction: no 403! Just the error message. *
Did you update your sample with AppId and AppSecret from your bot's registration portal page? Is Emulator using appId/AppSecret from portal?
Yes, I'm using my own AppID & my own App Secret from the registration portal in my NodeJS script and emulator
is this alexr*******bot ? with appSecret ending in d8?, I can't seem to hit your https://removed.de:removed/api/messages registration. Is that the right url?
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 52.29.235.61:YOURPORT
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at BotFrameworkEmulator.SessionModel.
Yes thats all correct. What do you mean you cant seem to hit the endpoint? I can reach it on my browser & postman. It's running on ubuntu on an aws machine
BTW: You can point the emulator directly to your endpoint, using your appId/appSecret to validate your bot directly.
Yes that works, my emulator is pointed at my endpoint and its working :/
really? hmmm.. let me spelunk in our logs and see if I can suss this out. Sorry for the trouble
No worries haha, this is fun :)
I'm experiencing the same thing, my bot's appId is makobot. Using HTTPS as well.

btw: when not using HTTPS, slack also receives a 403. Webchat always receives a 403 and the emulator always works
aha You registration is wrong Use the url that you have in the screenshot you sent me. I was able to talk to it, and what you had in your registration doesn't match that.
Are you talking about the endpoint on the registration page? Those are 1:1 the same

My bot IS receiving data from the microsoft backend. But isnt responding to it. It gets stuck before it reaches my code
It can take 5 minutes for our caches to clear. The data you just received was probably me using postman.