Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudDirectory: TypeError on listIndex operation #1332

Closed
k3karthic opened this issue Jan 28, 2017 · 5 comments · Fixed by #1346
Closed

CloudDirectory: TypeError on listIndex operation #1332

k3karthic opened this issue Jan 28, 2017 · 5 comments · Fixed by #1346

Comments

@k3karthic
Copy link

When i try to perform a listIndex operation (with or without RangesOnIndexedValues param) on my cloud directory the following error is thrown. The issue occurs on Lambda and on Node version 6.9.4.

The same operation when performed from the aws cli returns the expected result.

OS: CentOS 7
Node: v6.9.4
AWS SDK: v2.9.0

`
{ [TypeError: must start with number, buffer, array or string]
message: 'must start with number, buffer, array or string',
code: 'TypeError',
time: Sat Jan 28 2017 01:07:18 GMT+0000 (UTC),
statusCode: 200,
retryable: false,
retryDelay: 29.344943910837173 }

TypeError: must start with number, buffer, array or string
at fromObject (buffer.js:141:11)
at new Buffer (buffer.js:62:10)
at BinaryShape.decode64 [as toType] (/var/task/node_modules/aws-sdk/lib/util.js:112:134)
at translateScalar (/var/task/node_modules/aws-sdk/lib/json/parser.js:61:16)
at translate (/var/task/node_modules/aws-sdk/lib/json/parser.js:16:21)
at Object. (/var/task/node_modules/aws-sdk/lib/json/parser.js:29:20)
at Object.each (/var/task/node_modules/aws-sdk/lib/util.js:478:32)
at translateStructure (/var/task/node_modules/aws-sdk/lib/json/parser.js:25:8)
at translate (/var/task/node_modules/aws-sdk/lib/json/parser.js:13:30)
at Object. (/var/task/node_modules/aws-sdk/lib/json/parser.js:29:20)
`

@chrisradek
Copy link
Contributor

@k3karthic
Can you share what your parameters look like for this operation?

@k3karthic
Copy link
Author

The following snippet is what i am using,

let aws = require('aws-sdk');
aws.config.update({region: 'us-east-1'});

let client = new aws.CloudDirectory();
client.listIndex(
    {
        DirectoryArn: 'arn:aws:clouddirectory:us-east-1:<acc_no>:directory/AZE76Gb8lUQNvHWL3bqpO4k', 
        IndexReference: { 
            Selector: '$AQGRO-hm_JVEDbx1i926qTuJ05koCRypQ7yKUugJ1H-abg' 
        }
    }, 
    function(err, data) { 
        if (err) { 
            console.log(err); 
        } else { 
            console.log(data) 
        }
    }
);

@chrisradek
Copy link
Contributor

@k3karthic
I was able to reproduce the issue and have identified it as a bug. The error is occurring because CloudDirectory is sending back BinaryValue: null when an object is a non-binary type, and the SDK attempts to base64 decode the null value. I'm researching the best way to fix this in the SDK without impacting other services.

@chrisradek
Copy link
Contributor

@k3karthic
I have just merged in a fix for this issue. Thanks for reporting it! The next version of the SDK will include the fix, or you can install the SDK from the GitHub repo directly.

@lock
Copy link

lock bot commented Sep 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants