AWS.DynamoDB.DocumentClient显示“连接ENOBUFS 127.0.0.1:8000-本地)”

时间:2019-06-05 10:09:26

标签: node.js amazon-dynamodb dynamodb-queries amazon-dynamodb-streams dynamo-local

我正在尝试读取csv文件(该文件具有50万条记录),然后尝试将其插入dynamoDB表中。但是插入几次后,我收到此错误“ connect ENOBUFS 127.0.0.1:8000-Local(undefined:undefined)”

     var AWS = require("aws-sdk");
     var csv = require('csv-parser');
     var fs = require('fs');

     AWS.config.update({

      region: "local",
      endpoint: "http://localhost:8000"
   });

    var docClient = new AWS.DynamoDB.DocumentClient({
    convertEmptyValues: true
  });
     fs.createReadStream('employee.csv')
     .pipe(csv())
      .on('data', (row) => {
        var params = {
        TableName: "EmployeeTable",
        Item: {
            employeeName:row.db.employeeName
            "db_add_date": row.db_add_date,
            "db_update_date": row.db_update_date,
            "created_by": row.created_by,
            "updated_by": row.updated_by,
            "deleted_on": row.deleted_on,
            "description": row.description,


        }
    }


docClient.put(params, function (err, data) {
    if (err) {
        console.error("Unable to add movie", ". Error JSON:", 
JSON.stringify(err, null, 2));
    } else {
        console.log("PutItem succeeded:",data);
    }

})

.on('end', () => {
    console.log('CSV file successfully processed');

});

})

0 个答案:

没有答案
相关问题