Aws-sdk-js: [InvalidParameterType: Expected params.documents to be a string, Buffer, Stream, Blob, or typed array object]

Created on 1 Mar 2016  路  2Comments  路  Source: aws/aws-sdk-js

Hi,

I am using could search domain service in nodejs. While I am trying to upload a json object its showing

[InvalidParameterType: Expected params.documents to be a string, Buffer, Stream, Blob, or typed array object]

my function looks like,

 `var doc = { "type": "add",
              "id":   "tt0484562",
              "fields": {
                "title": "The Seeker: The Dark Is Rising",
                "directors": ["Cunningham, David L."],
                "genres": ["Adventure","Drama","Fantasy","Thriller"],
                "actors": ["McShane, Ian","Eccleston, Christopher","Conroy, Frances",
                          "Crewson, Wendy","Ludwig, Alexander","Cosmo, James",
                          "Warner, Amelia","Hickey, John Benjamin","Piddock, Jim",
                          "Lockhart, Emma"]
              }
    }

   var params = {
      contentType: 'application/json',
      documents: doc /* required */
    };

    csd.uploadDocuments(params, function(err, data) {
      console.log(err);
      if (!err) done(null,data);           // successful response
    });`

Please mention the exact format for params.documents

guidance

Most helpful comment

Fixed. I have used JSON.stringify(doc).

All 2 comments

Fixed. I have used JSON.stringify(doc).

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.

Was this page helpful?
0 / 5 - 0 ratings