Node.js + Express + simpledb; “TypeError: Cannot read property ‘Errors’ of null” when tryin…

I’m trying to get a very simple test of Amazon SimpleDB running with Node.js
/Express. This is the code I’m using (AWS key/secret sanitized, of course):

var express = require('express');
var simpledb = require('simpledb');

var app = express.createServer();
var sdb = new simpledb.SimpleDB(
        {keyed:'MYKEY', secret:'MYSECRET'}, simpledb.debuglogger);

app.get('/', function(req, res) {
        console.log("about to list domains...");
        sdb.listDomains(function(error, result, meta) {
                console.log("listing domains, I think?");
        });
});

app.listen(8888);

This is the error I’m getting:

DEBUG: simpledb:  2012-04-06T01:34:24.856Z create {"keyid":"MYKEY","secret":"MYSECRET","secure":false,"consistent":true,"test":false,"maxtry":null,"expbase":null,"delaymin":null,"delayscale":null,"randomdelay":null} {"secure":false,"host":"sdb.amazonaws.com","path":"/","version":"2009-04-15","port":80}
about to list domains...
DEBUG: simpledb:  2012-04-06T01:34:29.253Z request 1333676069253 ListDomains {}
DEBUG: simpledb:  2012-04-06T01:34:29.387Z handle 1333676069253 ListDomains {"Action":"ListDomains","Version":"2009-04-15","SignatureMethod":"HmacSHA256","SignatureVersion":"2","Timestamp":"2012-04-06T01:34:29.253Z","AWSAccessKeyId":"MYKEY","Signature":"AWSSIGNATURE"} 1 false null

/home/rob/node_modules/simpledb/lib/simpledb.js:136
    if( res.Errors ) {
           ^
TypeError: Cannot read property 'Errors' of null
    at [object Object].handle (/home/rob/node_modules/simpledb/lib/simpledb.js:136:12)
    at /home/rob/node_modules/simpledb/lib/simpledb.js:188:18
    at Parser. (/home/rob/node_modules/simpledb/node_modules/aws-lib/lib/aws.js:81:13)
    at Parser.emit (events.js:67:17)
    at Object.onclosetag (/home/rob/node_modules/simpledb/node_modules/aws-lib/node_modules/xml2js/lib/xml2js.js:120:24)
    at emit (/home/rob/node_modules/simpledb/node_modules/aws-lib/node_modules/sax/lib/sax.js:148:32)
    at emitNode (/home/rob/node_modules/simpledb/node_modules/aws-lib/node_modules/sax/lib/sax.js:152:3)
    at closeTag (/home/rob/node_modules/simpledb/node_modules/aws-lib/node_modules/sax/lib/sax.js:226:5)
    at Object.write (/home/rob/node_modules/simpledb/node_modules/aws-lib/node_modules/sax/lib/sax.js:567:29)
    at Parser. (/home/rob/node_modules/simpledb/node_modules/aws-lib/node_modules/xml2js/lib/xml2js.js:145:29)

I’m pretty new to Node.js
, the simpledb module and SimpleDB itself, but this to me seems like a bug in the simpledb module. I can’t figure out what I’m doing wrong otherwise – I’m confident my key/secret are valid (as I’ve tested with both set invalid, separately and together, and I get back actual errors from Amazon that indicate the key/secret are invalid).

This error, though, has me stumped. Any ideas?

Problem courtesy of: Rob Ringham

Solution

This turned out to be a dependency issue in the simpledb node module:

Hi - this seems to have been caused by the latest version of a dependent lib - I've rebuilt and publish a new version 0.0.8 - please let me know if this works - thanks!

Source.
It has since been fixed.

Solution courtesy of: Rob Ringham

稿源:Node.js Recipes (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » Node.js + Express + simpledb; “TypeError: Cannot read property ‘Errors’ of null” when tryin…

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录