AWS JS SDK TypeError:STS不是构造函数 [英] AWS JS SDK TypeError: STS is not a constructor

查看:187
本文介绍了AWS JS SDK TypeError:STS不是构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆