Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 凭证错误:";配置中缺少凭据";即使设置了凭据_Javascript_Amazon Web Services_Amazon Cognito_Amazon Ses - Fatal编程技术网

Javascript 凭证错误:";配置中缺少凭据";即使设置了凭据

Javascript 凭证错误:";配置中缺少凭据";即使设置了凭据,javascript,amazon-web-services,amazon-cognito,amazon-ses,Javascript,Amazon Web Services,Amazon Cognito,Amazon Ses,我正在尝试使用未经验证的Cognito身份池通过SES发送电子邮件,使用网络表单。我使用的是普通的JS,没有Node/jQuery/React function sendMessage(event) { var params = ...; AWS.config = new AWS.Config({ region: 'us-west-2', credentials: new AWS.CognitoIdentityCredentials({ // Unauthe

我正在尝试使用未经验证的Cognito身份池通过SES发送电子邮件,使用网络表单。我使用的是普通的JS,没有Node/jQuery/React

function sendMessage(event) {
  var params = ...;

  AWS.config = new AWS.Config({
    region: 'us-west-2',
    credentials: new AWS.CognitoIdentityCredentials({
      // Unauthenticated pool for sending emails
      IdentityPoolId: 'us-west-2:foo'
    })
  });

  var SES = new AWS.SES({ apiVersion: '2010-12-01' });
  SES.sendEmail(params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
  });
}
我已将此设置为表单的onsubmit事件,但每次提交时,都会出现
CredentialsError:“配置中缺少凭据”

按照我的理解,我不必通过
get()
调用下拉并显式设置访问和密钥。Cognito和general SDK文档中提供的所有代码示例都表明,您可以直接实例化服务对象并开始进行调用。也不应该有任何比赛条件,正如我在中发现的:

从v2.1.20开始,当发出请求时,将延迟获取凭据

我使用的是v2.597。我错过了什么?为什么这不起作用