首页 > 解决方案 > TypeError:AWS.rekognition 不是构造函数

问题描述

const AWS  = require('aws-sdk')

AWS.config.loadFromPath('./credentials.json');
AWS.config.update({region:'us-east-1'});


var rekognition = new AWS.rekognition();

var params = {
    CollectionId: "sammple", 
    DetectionAttributes: [  
    ], 
    ExternalImageId: "facialrekogntition",  //TODo
    Image: {
     S3Object: {
      Bucket: "facerekognition12", 
      Name: "download.jpg"
     }
    }
   };
   rekognition.indexFaces(params, function(err, data) {
     if (err) console.log(err, err.stack); // an error occurred
     else     console.log(data);           // successful response
   });

每当我使用时,都会node index.js收到标题中提到的错误。

注意- 我的凭证存储在 JSON 文件中,并且还安装了 AWS-SDK for node。

标签: javascriptnode.jsamazon-web-servicesamazon-rekognition

解决方案


基本new AWS.Rekognition();都是资本R


推荐阅读