AskYous
AskYous

Reputation: 4740

No response from Botbuilder bot on localhost, but works in Azure

I was trying to follow this tutorial which required me to download the bot code, run it locally and test it using the Botframework Emulator. When I chatted in the emulator, it returned no response.

When I use Azure's web chat emulator, it worked great!

I set up the bot using these instructions on Azure, so all the necessary resources were up and running automatically. When I chat, the node console prints the following:

WARN: ChatConnector: receive - emulator running without security enabled. logger.js:24 ChatConnector: message received.

And sometimes, it errors with this:

Error: Failed to initialize azure table client. Error: Error: Failed to perform the requested operation on Azure Table. Message: connect ECONNREFUSED 127.0.0.1:10002. Error code: ECONNREFUSED UniversalBot.js:548

I don't know if that's related or a separate issue.

Upvotes: 0

Views: 792

Answers (2)

SMshrimant
SMshrimant

Reputation: 719

Could your please try this. I think it is not working because your endpoint and name are not correct

Upvotes: 0

Fei Han
Fei Han

Reputation: 27805

WARN: ChatConnector: receive - emulator running without security enabled. logger.js:24 ChatConnector: message received.

This is just a warning, which might be caused by using http URL: http://localhost:3978/api/messages as message endpoint in emulator.

Error: Failed to initialize azure table client. Error: Error: Failed to perform the requested operation on Azure Table.

If you check the code, you can find that it uses Azure Table storage to store and manage your bot’s state data:

var tableName = 'botdata';
var azureTableClient = new botbuilder_azure.AzureTableClient(tableName, process.env['AzureWebJobsStorage']);
var tableStorage = new botbuilder_azure.AzureBotStorage({ gzipData: false }, azureTableClient);

// Create your bot with a function to receive messages from the user
var bot = new builder.UniversalBot(connector);
bot.set('storage', tableStorage);

The code will use 'AzureWebJobsStorage' connection string to initiate azureTableClient, if you do not provide a connection string for 'AzureWebJobsStorage', it will throw the above error.

Please try to set a environment variable for 'AzureWebJobsStorage' or specify your connection string in your code directly.

var azureTableClient = new botbuilder_azure.AzureTableClient(tableName, '{your_storage_connection_string_here}');

Upvotes: 1

Related Questions