Bot-docs: Error: Invalid plugin type being added

Created on 6 Feb 2019  Â·  5Comments  Â·  Source: MicrosoftDocs/bot-docs

When inserting additional classes like const{ ConversationState, MemoryStorage, CosmosDbStorage } = require('botbuilder')
and initialising the following code snippet, I receive the following error:
Error: MiddlewareSet.use(): invalid plugin type being added.
at middleware.forEach (.../node_modules\botbuilder-core\lib\middlewareSet.js:58:23)
at Array.forEach (<anonymous>)
at MiddlewareSet.use (...\node_modules\botbuilder-core\lib\middlewareSet.js:50:20)
at BotFrameworkAdapter.use (...\node_modules\botbuilder-core\lib\botAdapter.js:31:53)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

Additional code snippet:
// Add memory storage.
var storage = new MemoryStorage();
const conversationState = new ConversationState(storage);
adapter.use(conversationState);

Would be nice if you can provide help.
Best


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

All 5 comments

You _might_ be missing npm packages. Try this quickstart to see if you can build/run node a project from the start.

Yes, that works fine, I tried it several times, also all the samples are running and the bots are startable.
It seems that the adapter.use(conversationState); statement is causing the problem. When removing at least I can write to CosmosDB.
Which packages could be causing this? Do you have any other explanation and help for it?

Any answer?

Any answer for this? I am also facing the same issue.

CosmosDbStorage is in botbuilder-azure https://github.com/Microsoft/botbuilder-js/blob/master/libraries/botbuilder-azure/src/cosmosDbStorage.ts

If the preference is to use CosmosDbStorage, it should be imported from the botbuilder-azure npm:

 const{ CosmosDbStorage } = require('botbuilder-azure');
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Anand-Moghe picture Anand-Moghe  Â·  4Comments

dipbanik picture dipbanik  Â·  7Comments

wilmol picture wilmol  Â·  3Comments

pkirch picture pkirch  Â·  4Comments

montacerdk picture montacerdk  Â·  5Comments