rjrodger / simpledb Goto Github PK
View Code? Open in Web Editor NEWAn Amazon AWS SimpleDB library for Node.js that is user-friendly and fault-tolerant
License: Other
An Amazon AWS SimpleDB library for Node.js that is user-friendly and fault-tolerant
License: Other
I have no issue running the program I had written on my local machine. the simpledb library runs perfect and my app.'s script is running without errors. However when I push this to my AWS machine, i get the following 'error' in the debugger. I am not sure why I get this since its the same exact code and it happens whether i try to list domains or a simple select. I'm confused as to why this is happening.
DEBUG: simpledb: 2014-03-24T03:57:29.499Z create {"keyid":"","secret":"","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,"nolimit":false,"maxlimit":2500}
util.debug: Use console.error instead
DEBUG: simpledb: 2014-03-24T03:57:29.531Z request 1395633449531 Select {"SelectExpression":"select * from stockfeed_new
where idOfTextStatus > '444080819490283521' order by idOfTextStatus asc limit 10","ConsistentRead":"true"}
util.debug: Use console.error instead
DEBUG: simpledb: 2014-03-24T03:57:29.562Z status false 1 false 0 {}
util.debug: Use console.error instead
DEBUG: simpledb: 2014-03-24T03:57:29.891Z status false 2 false 325.94354087486863 {}
util.debug: Use console.error instead
DEBUG: simpledb: 2014-03-24T03:57:30.058Z status false 3 false 165.23593217134476 {}
util.debug: Use console.error instead
DEBUG: simpledb: 2014-03-24T03:57:36.199Z status false 4 true 6134.611403942108 {}
The results array is global to the module. if a client makes two simultaneous selects, one select return with also include results from the other select.
I suggest scoping results to a function.
Small typo:
sdb.listDomains( functions( error, result, meta ) {
if( error ) {
console.log('listDomains failed: '+error.Message )
}
else {
// do stuff with result, an array of domain names
}
})
change functions to function.
I'm trying to connect to my simpleDB from a network with proxy, I need to config proxy so I can connect to DB. How ca I do it?
npm, as far as I can tell, is still registering the previous version of simpledb. I'd like to take advantage of the newer commands that have been added to the library and still keep my node packages managed via npm. Can this be updated?
When I perform an API request and I'm not connected to the internet I get:
Error: ETIMEOUT, Timeout while contacting DNS servers
at Timer.callback (dns.js:38:13)
Ideally timeouts would be passed to our callbacks as an error parameter, I think. And maybe we could set the timeout duration as an option as well? No sense waiting a minute (or whatever the default is) to tell the client that we can't reach SimpleDb.
Thanks again for an excellent module.
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(
{keyid:'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.<anonymous> (/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.<anonymous> (/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?
I've found that when I either
a) make a select request (e.g. 'select itemName() from domain') or;
b) make a putItem request that contains parentheses
I get the following error
{ Code: 'SignatureDoesNotMatch',
Message: 'The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.' }
When I remove the parentheses both queries work fine. I'm using Node v0.4.1. Can't seem to figure out what's causing the signature I send over to be created incorrectly.
Any ideas?
Thanks!
-Chris
The following code makes Amazon respond with HTTP 403 and error code "SignatureDoesNotMatch":
var simpledb = require('simpledb');
sdb = new simpledb.SimpleDB({keyid:'...', secret:'...'});
sdb.putItem('test', 'item01', {my_key:'this character will break the request: !'}, function(err){
if (err) throw err.Message;
});
When I remove the exclamation mark from the item no error is returned.
The MetaData object in the callback lacks a NextToken. I would also highly appreciate a build in paginator for library.
When using putItem or batchPutItem empty strings are not written to SDB. These writes do not seem to be included in the API request, maybe because "" == false somewhere.
To replicate:
var SimpleDb = require('simpledb');
var sdb = new SimpleDb.SimpleDB({
keyid: 'keyid',
secret: 'secret'
});
var fPutGet = function (inItemName, inValue) {
// Write the item to SDB and read it back
sdb.putItem(
'testDomain',
inItemName,
{ 'someAttribute': inValue },
function (inError, inResult, inMeta) {
console.log('putItem done (' + inItemName + ':' + inValue + '), error:', inError);
sdb.getItem(
'testDomain',
inItemName,
function (inError, inResult, inMeta) {
console.log('getItem done (' + inItemName + ':' + inValue + '), result:', inResult);
}
);
}
);
}
sdb.createDomain(
'testDomain',
function () {
console.log('createDomain done');
fPutGet('item1', 'not empty');
fPutGet('item2', '');
}
);
It seems that there is no support for regions.
I tried to init SimpleDB with:
var sdb = new simpledb.SimpleDB(
{
keyid:'xxxxxx',
secret:'xxxx',
region:'eu-west-1'
},
simpledb.debuglogger
);
But it still returns US region data.
autotoken:true config param
automatically repeat request
I am trying to write an array of items to SimpleDB via batchPutItems. For some reason, only the first item in the array is stored. All items are well formed, with an $ItemName attribute. Storing every single item with putItem works fine.
The simpledb library requires users to provide an AWS keyid and secret, while the underlying aws-lib support creating a client without AWS credentuals - in which case it uses IAM role based authentication for running under EC2.
Simpledb should support logging in without specifying AWS credentials using aws-lib IAM role support.
when the http connection (in aws) emits a socket hangup, my application crashes instead of returning or throwing an error .
This is easily reproduced on a long query if there is a long time between a select call and the select call with the "next token".
or look for a function earlier in the arg list
As of npm 0.3.0, the package.json file must be strict JSON format, not just a JavaScript object. The items in the array "keywords" should have double quotes instead of single quotes.
Allow optional attribute/value spanning to store values larger than 1024 bytes.
@tracend you know better than me :)
Moving this project to adding you as a contrib, see https://github.com/rvagg/node-levelup/blob/master/CONTRIBUTING.md in any case because it is stagnating a bit
Hi!
It would be very nice, if the library will provide some means to cancel requests. Exponential back-off algo is really cool, but sometime it is absolutely necessary to be able to cancel too long running request.
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.