joshuahoover / botkit-storage-dynamodb Goto Github PK
View Code? Open in Web Editor NEWA DynamoDB storage module for Botkit.
License: MIT License
A DynamoDB storage module for Botkit.
License: MIT License
Dynasty appears to be causing an error in v 0.2.0
Here is the error I get when starting my botkit
server
>node server.js
c:\botdir\node_modules\dynasty\node_modules\bluebird\js\main\promisify.js:55
throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/iWrZbw\u000a"
^
TypeError: Cannot promisify an API that has normal methods with 'Async'-suffix
See http://goo.gl/iWrZbw
at checkValid (c:\botdir\node_modules\dynasty\node_modules\bluebird\js\main\promisify.js:55:27)
at promisifiableMethods (c:\botdir\node_modules\dynasty\node_modules\bluebird\js\main\promisify.js:78:5)
at promisifyAll (c:\botdir\node_modules\dynasty\node_modules\bluebird\js\main\promisify.js:241:9)
at Function.Promise.promisifyAll (c:\botdir\node_modules\dynasty\node_modules\bluebird\js\main\promisify.js:304:12)
at new Dynasty (c:\botdir\node_modules\dynasty\lib\dynasty.js:39:15)
at module.exports (c:\botdir\node_modules\dynasty\lib\dynasty.js:224:12)
at module.exports (c:\botdir\node_modules\botkit-storage-dynamodb\src\index.js:17:32)
at Object.<anonymous> (c:\botdir\app\controllers\botkit_facebook.js:15:53)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Server.server.listen (c:\botdir\server.js:35:3)
at Server.g (events.js:292:16)
at emitNone (events.js:86:13)
at Server.emit (events.js:185:7)
at emitListeningNT (net.js:1288:10)
at _combinedTickCallback (internal/process/next_tick.js:77:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
I might just be doing something stupid but I can't get tests to pass on this project. Are they working ok for you?
→ npm test
> [email protected] pretest /Users/andrew/Personal/git-devel/botkit-storage-dynamodb
> jscs ./
> [email protected] test /Users/andrew/Personal/git-devel/botkit-storage-dynamodb
> istanbul cover --report lcov --dir coverage/ _mocha ./tests --grep ./tests/*.js -- --colors
Dynamo
Initialization
1) should throw an error if config is missing
2) should throw an error if dynamoRegion is missing
3) should throw an error if dynamoAccessKey is missing
4) should throw an error if dynamoAccessSecret is missing
✓ should initialize dynasty with dynamoRegion, dynamoAccessKey, dynamoAccessSecret
teams.get
5) should call find with callback
teams.save
6) should call update
teams.all
7) should call findAll
channels.get
8) should call find with callback
channels.save
9) should call update
channels.all
10) should call findAll
users.get
11) should call find with callback
users.save
12) should call update
users.all
13) should call findAll
1 passing (175ms)
13 failing
1) Dynamo Initialization should throw an error if config is missing:
AssertionError: expected Function {
name: '(config){__cov_wBJJ_XJenSJcZMEPIh8EXg.f[\'1\']++;__cov_wBJJ_XJenSJcZMEPIh8EXg.s[\'2\']++;if((__cov_wBJJ_XJenSJcZMEPIh8EXg.b[\'2\'][0]++,!config)||(__cov_wBJJ_XJenSJcZMEPIh8EXg.b[\'2\'][1]++,!config.dynamoRegion)||(__cov_wBJJ_XJenSJcZMEPIh8EXg.b[\'2\'][2]++,!config.dynamoAccessKey)||'
} to throw exception with a message matching 'Need to provide dynamo dynamoRegion, dynamoAccessKey, dynamoAccessSecret', but got 'Need to provide dynamoRegion, dynamoAccessKey, dynamoAccessSecret'
at Assertion.fail (node_modules/should/lib/assertion.js:92:17)
at Assertion.Object.defineProperty.value (node_modules/should/lib/assertion.js:164:19)
at Context.<anonymous> (tests/index.js:36:33)
2) Dynamo Initialization should throw an error if dynamoRegion is missing:
AssertionError: expected Function { name: '' } to throw exception with a message matching 'Need to provide dynamo dynamoRegion, dynamoAccessKey, dynamoAccessSecret', but got 'Need to provide dynamoRegion, dynamoAccessKey, dynamoAccessSecret'
at Assertion.fail (node_modules/should/lib/assertion.js:92:17)
at Assertion.Object.defineProperty.value (node_modules/should/lib/assertion.js:164:19)
at Context.<anonymous> (tests/index.js:42:57)
3) Dynamo Initialization should throw an error if dynamoAccessKey is missing:
AssertionError: expected Function { name: '' } to throw exception with a message matching 'Need to provide dynamo dynamoRegion, dynamoAccessKey, dynamoAccessSecret', but got 'Need to provide dynamoRegion, dynamoAccessKey, dynamoAccessSecret'
at Assertion.fail (node_modules/should/lib/assertion.js:92:17)
at Assertion.Object.defineProperty.value (node_modules/should/lib/assertion.js:164:19)
at Context.<anonymous> (tests/index.js:48:57)
4) Dynamo Initialization should throw an error if dynamoAccessSecret is missing:
AssertionError: expected Function { name: '' } to throw exception with a message matching 'Need to provide dynamo dynamoRegion, dynamoAccessKey, dynamoAccessSecret', but got 'Need to provide dynamoRegion, dynamoAccessKey, dynamoAccessSecret'
at Assertion.fail (node_modules/should/lib/assertion.js:92:17)
at Assertion.Object.defineProperty.value (node_modules/should/lib/assertion.js:164:19)
at Context.<anonymous> (tests/index.js:54:57)
5) Dynamo teams.get should call find with callback:
TypeError: Cannot read property 'then' of undefined
at Object.get (src/index.js:9:1609)
at Context.<anonymous> (tests/index.js:74:41)
6) Dynamo teams.save should call update:
TypeError: Cannot read property 'then' of undefined
at Object.save (src/index.js:9:2370)
at Context.<anonymous> (tests/index.js:84:41)
7) Dynamo teams.all should call findAll:
TypeError: Cannot read property 'then' of undefined
at Object.all (src/index.js:9:2850)
at Context.<anonymous> (tests/index.js:96:41)
8) Dynamo channels.get should call find with callback:
TypeError: Cannot read property 'then' of undefined
at Object.get (src/index.js:9:1609)
at Context.<anonymous> (tests/index.js:74:41)
9) Dynamo channels.save should call update:
TypeError: Cannot read property 'then' of undefined
at Object.save (src/index.js:9:2370)
at Context.<anonymous> (tests/index.js:84:41)
10) Dynamo channels.all should call findAll:
TypeError: Cannot read property 'then' of undefined
at Object.all (src/index.js:9:2850)
at Context.<anonymous> (tests/index.js:96:41)
11) Dynamo users.get should call find with callback:
TypeError: Cannot read property 'then' of undefined
at Object.get (src/index.js:9:1609)
at Context.<anonymous> (tests/index.js:74:41)
12) Dynamo users.save should call update:
TypeError: Cannot read property 'then' of undefined
at Object.save (src/index.js:9:2370)
at Context.<anonymous> (tests/index.js:84:41)
13) Dynamo users.all should call findAll:
TypeError: Cannot read property 'then' of undefined
at Object.all (src/index.js:9:2850)
at Context.<anonymous> (tests/index.js:96:41)
=============================================================================
Writing coverage object [/Users/andrew/Personal/git-devel/botkit-storage-dynamodb/coverage/coverage.json]
Writing coverage reports at [/Users/andrew/Personal/git-devel/botkit-storage-dynamodb/coverage]
=============================================================================
=============================== Coverage summary ===============================
Statements : 63.33% ( 19/30 )
Branches : 50% ( 8/16 )
Functions : 53.85% ( 7/13 )
Lines : 63.33% ( 19/30 )
================================================================================
npm ERR! Test failed. See above for more details.
I decided to give botkit-storage-dynamodb a try, but apparently this breaks my bot code. More details: I am using Spark and watson-middleware, and I explicitly use channel storage to save ongoing conversation text between a bot and a user (direct messages). Bot was working fine with json file storage (the default in Botkit). When I introduce botkit-storage-dynamodb I see the following error message from watson-middleware:
ValidationException: ExpressionAttributeValues contains invalid value: Input collection contains duplicates for key :context {"cause":{"message":"ExpressionAttributeValues contains invalid value: Input collection contains duplicates for key :context","code":"ValidationException","time":"2017-12-18T21:34:39.246Z","requestId":"ABJ7VT1PB7JBUDVQAFSF9M210BVV4KQNSO5AEMVJF66Q9ASUAAJG","statusCode":400,"retryable":false,"retryDelay":18.287361752594443},"code":"ValidationException","time":"2017-12-18T21:34:39.246Z","requestId":"ABJ7VT1PB7JBUDVQAFSF9M210BVV4KQNSO5AEMVJF66Q9ASUAAJG","statusCode":400,"retryable":false,"retryDelay":18.287361752594443}
I'm unclear as to what is causing this error, but I have to suspect that something in the storage implementation is causing trouble. Can you help?
Could we please get an update of the package in NPM with the latest code that's been merged? Currently, I have to point to the commit hash in my package.json, which is a bit clunky.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.