pveller/ecommerce-chatbot

Type error: length undefined

Closed this issue · 8 comments

TypeError: Cannot read property 'length' of undefined
at a.Authenticate (/home/siddhant/PROJECT/adventureworks-moltin/node_modules/moltin/dist/moltin.nodejs.min.js:2:2213)
at Promise (/home/siddhant/PROJECT/adventureworks-moltin/promisify-moltin.js:30:20)
at new Promise ()
at Object.Create (/home/siddhant/PROJECT/adventureworks-moltin/promisify-moltin.js:29:16)
at Rx.Observable.defer (/home/siddhant/PROJECT/adventureworks-moltin/categories.js:22:73)
at tryCatcher (/home/siddhant/PROJECT/adventureworks-moltin/node_modules/rx/dist/rx.js:63:31)
at Defer.subscribeCore (/home/siddhant/PROJECT/adventureworks-moltin/node_modules/rx/dist/rx.js:2536:37)
at Defer.tryCatcher (/home/siddhant/PROJECT/adventureworks-moltin/node_modules/rx/dist/rx.js:63:31)
at Rx.internals.ScheduledItem.setDisposable [as action] (/home/siddhant/PROJECT/adventureworks-moltin/node_modules/rx/dist/rx.js:2082:46)
at Rx.internals.ScheduledItem.ScheduledItem.invokeCore (/home/siddhant/PROJECT/adventureworks-moltin/node_modules/rx/dist/rx.js:896:33)

Hi, I'm getting the above error while running the app.js and pointing to the Adventure Works Scipts. How can i move forward? @pveller

I just published the update to the adventureworks-moltin scripts. It now uses the v2 APIs. Please re-read the instructions and give it a try.

Yes, worked. Thanks. But the files in ecommerce-chatbot git repo still have the issue. i created an assure search service with the url of commercechatsid. then added the 3 indexes to it. To run the script i added the commercechatsid to the seacrh api name and my admin key to the search api key fields. but while execution i'm getting the following error.

Fetching products from 1 to 100
TypeError: Cannot read property 'length' of undefined
at a.Authenticate (/home/siddhant/PROJECT/ecommerce-chatbot/node_modules/moltin/dist/moltin.nodejs.min.js:2:2213)
at Promise (/home/siddhant/PROJECT/ecommerce-chatbot/lib/promisify-moltin.js:30:20)
at new Promise ()
at Object.Tree (/home/siddhant/PROJECT/ecommerce-chatbot/lib/promisify-moltin.js:29:16)
at Object. (/home/siddhant/PROJECT/ecommerce-chatbot/indexes/populate.js:14:38)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)

Alright. I upgraded all the packages, refactored the search index generation scripts, and verified that the bot works in the emulator. Read the updated README and give it a shot.

Hey, thanks for the quick update. I ran the same node indexes/populate.js and came across this error.

(node:9435) UnhandledPromiseRejectionWarning: TypeError: topCategory.children is not iterable
at /home/siddhant/PROJECT/ecommerce-chatbot/indexes/populate.js:32:35
at
at process._tickCallback (internal/process/next_tick.js:160:7)
(node:9435) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9435) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Make sure you have re-created your Moltin catalog with the latest scripts. I would recommend that you ensure categories and everything else was re-created. Use the --clean options:

node app.js 'path-to-AW-catalog' --clean categories --clean variations --clean products --clean files

Also make sure that your MOLTIN_CLIENT_ID and MOLTIN_CLIENT_SECRET point at the same catalog when you run both scripts.

And just in case, make sure you run on the latest node (8.9.4). I will go ahead and re-run everything on a clean store later today to double check

Hi, yeah. It's working now. Thanks a ton. Also, can you help me with which type of app i will need to create in azure app services and bot framework. Thanks.

I would suggest that you start with the emulator.

Then, when you ready to deploy, just follow one of the Azure guidelines. You are basically deploying a node.js web app to the App Service so any step by step instruction should be ok (example). I did everything from the Azure console and have not used the CLI.

And finally, the bot. I haven't used the new Azure Bot Service and my bot were all set up over at https://dev.botframework.com. So maybe you start there and follow the instructions? Good luck!