2

设想

  1. 我有一个托管在 S3 中的无服务器反应 js 应用程序。
  2. 我正在使用 Cognito 进行用户身份验证。
  3. 使用quicksight:CreateUser权限 配置 Cognito 身份认证角色 。
  4. 我从 S3 中的数据文件将数据加载到 Quicksight 并创建了一个仪表板。

我正在使用下面的代码从我的节点 js (v8.10) lambda 函数创建一个嵌入式仪表板 URL。

const AWS = require('aws-sdk');
var quicksight = new AWS.QuickSight({
    region: 'us-east-1'
});
return quicksight.getDashboardEmbedUrl({
                'AwsAccountId': 'XXXXX',
                'DashboardId': 'YYYYYYY',
                'IdentityType': 'IAM',
                'ResetDisabled': true,
                'SessionLifetimeInMinutes': 100,
                'UndoRedoDisabled': false
            }).promise().then((res) => {
                console.log('Response: ');
                console.log(res);
            }).catch((err) => {
                console.log('Error: ');
                console.log(err);
            })

**

我收到以下错误。

**

2019-01-15T17:48:42.496Z    cafaa35a-18ed-11e9-9e84-ad156518dcbe    { UnknownError: Forbidden
at Object.extractError (/var/task/node_modules/aws-sdk/lib/protocol/json.js:51:27)
at Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/rest_json.js:52:8)
at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /var/task/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:685:12)
message: 'Forbidden',
code: 'UnknownError',
statusCode: 403,
time: 2019-01-15T17:48:42.440Z,
requestId: 'XXXX',
retryable: false,
retryDelay: 1.6256019461018845 }


2019-01-15T17:48:42.938Z    cafaa35a-18ed-11e9-9e84-ad156518dcbe    Error: 
2019-01-15T17:48:42.938Z    cafaa35a-18ed-11e9-9e84-ad156518dcbe    { QuickSightUserNotFoundException: Could not find user information in QuickSight
at Object.extractError (/var/task/node_modules/aws-sdk/lib/protocol/json.js:51:27)
at Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/rest_json.js:52:8)
at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /var/task/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:685:12)
message: 'Could not find user information in QuickSight',
code: 'QuickSightUserNotFoundException',
time: 2019-01-15T17:48:42.938Z,
requestId: 'XXXXX,
statusCode: 412,
retryable: false,
retryDelay: 84.05706341238961 }

知道为什么会这样吗?我是否也必须在 quicksight 门户中添加用户?我认为快速视觉认知集成是即插即用的。

提前感谢您的帮助。

4

3 回答 3

2

请参阅以下线程,该线程提供了以编程方式生成嵌入式 URL 的详细过程。

如何获取/生成 aws quicksight 安全仪表板 URL

于 2019-01-23T11:51:50.760 回答
1

查看此示例存储库。它来自亚马逊工程师。使用 Cloudformation。

https://github.com/aws-samples/amazon-quicksight-embedding-sample

于 2019-02-11T20:46:41.570 回答
0

我有一个类似的问题,得到 QuickSightUserNotFoundException 错误。

我关注了这篇文章:

QuickSightUserNotFoundException 使用 cognito 用户获取 AWS Quicksight 嵌入 URL 时

要点是“在注册用户时,IdentityType 必须是 IAM,但对于 getDashboardEmbedUrl,它必须是 QUICKSIGHT 类型,并且您需要传递 UserArn,您可以在 registerUser 的响应中找到它”

于 2020-09-01T16:54:18.563 回答