AWS JS SDK TypeError:STS不是构造函数 [英] AWS JS SDK TypeError: STS is not a constructor
问题描述
我有一个ReactJS应用程序,该应用程序使用aws-sdk进行cognito登录.我使用yarn
安装所有模块,但是当我尝试访问位于localhost的网站时,出现JS错误:未捕获(承诺)TypeError:STS不是构造函数.
I'm have a ReactJS application that uses the aws-sdk for cognito login. I used yarn
to install all modules, but when I try to access the website at localhost I get a JS error: Uncaught (in promise) TypeError: STS is not a constructor.
错误指向aws-sdk
凭据文件中的这一行:
this.sts = this.sts || new STS(clientConfig);
The error points to this line in the aws-sdk
credentials file:
this.sts = this.sts || new STS(clientConfig);
STS
的来源:var STS = require('../../clients/sts');
关于如何解决此错误的任何想法?我尝试安装其他模块或升级它们,但是继续出现此错误.
Any thoughts on how to resolve this error? I've tried installing other modules or upgrading them, but continue to get this error.
编辑-VUE.js示例:
import {
Config as AWSConfig,
CognitoIdentityCredentials,
} from 'aws-sdk/global';
import LexRuntime from 'aws-sdk/clients/lexruntime';
import Polly from 'aws-sdk/clients/polly';
推荐答案
我认为new STS(...)
给您这样的错误 STS in not a constructor
.
请从中删除new
运算符:
I think new STS(...)
gives you such error of STS in not a constructor
.
Please get rid of new
operator from it:
this.sts = this.sts || STS(clientConfig);
这篇关于AWS JS SDK TypeError:STS不是构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!