###前提・実現したいこと
ここに質問したいことを詳細に書いてください
AWS SDKを使用し、AWSアカウント情報を表示するものを実装していますが、以下のエラーが発生しました。
どのようにすればアカウント情報を表示できるかのか教えていただけますでしょうか。
###発生している問題・エラーメッセージ
(node:758) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: undefined is not a function (node:758) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
###該当のソースコード
Node.js
1const AWS = require('aws-sdk'); 2const ec2 = new AWS.EC2({region: 'ap-northeast-1'}); 3const sts = new AWS.STS(); 4const date = new Date(); 5const co = require('co'); 6 co(function *() { 7 let accountId = yield getAccountId(); 8 console.log(accountId); 9 }); 10function getAccountId() { 11 var params = {}; 12 var result = []; 13 result = sts.getCallerIdentity(params).promise(); 14 return Promise.all(result).then(data => data); 15};
###補足情報(言語/FW/ツール等のバージョンなど)
node -v
v7.9.0
あなたの回答
tips
プレビュー