资源找不到查询DynamoDB

发布于 2025-02-04 07:13:45 字数 1108 浏览 2 评论 0原文

我正在尝试访问DynamoDB表,但是我一直在获得“未找到资源”错误。

该表的定义如下,请注意,该表是有效的,该区域是巴黎(EU-West-3)

“在此处输入图像说明”

我正在使用的代码:

export class EncuestaComponent implements OnInit {

  [...]
  client: DynamoDBClient = new DynamoDBClient({
    region : 'eu-west-3',
    credentials: {
      accessKeyId: '[REDACTED]',
      secretAccessKey: '[REDACTED]'
    }
  });
  [...]
  onDbClick() {
    const commandParams = {};
    const input: BatchExecuteStatementInput = {
      Statements: [
        {Statement: "SELECT opciones FROM encuesta.encuesta WHERE id = 'user.1'"}
      ],
    }
    const command = new BatchExecuteStatementCommand(input);
    this.client.send(command).
      then(data => console.log(data.Responses![0].Error)).
      catch(error => {console.log("Error"); console.log(error)});
  }

并且,在控制台中,它显示<< em> then 方法已执行,但是打印的消息是 {code:'resourcenotfound',message:'未找到请求资源'}

我在做什么错?

I am trying to access a DynamoDb table, but I keep getting a "Resource not found" error.

The table is defined as follows, note that the table is Active and the Region is Paris (eu-west-3)

enter image description here

The code I am using:

export class EncuestaComponent implements OnInit {

  [...]
  client: DynamoDBClient = new DynamoDBClient({
    region : 'eu-west-3',
    credentials: {
      accessKeyId: '[REDACTED]',
      secretAccessKey: '[REDACTED]'
    }
  });
  [...]
  onDbClick() {
    const commandParams = {};
    const input: BatchExecuteStatementInput = {
      Statements: [
        {Statement: "SELECT opciones FROM encuesta.encuesta WHERE id = 'user.1'"}
      ],
    }
    const command = new BatchExecuteStatementCommand(input);
    this.client.send(command).
      then(data => console.log(data.Responses![0].Error)).
      catch(error => {console.log("Error"); console.log(error)});
  }

And, in the console, it shows that the then method has been executed, but the message printed is {Code: 'ResourceNotFound', Message: 'Requested resource not found'}

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玻璃人 2025-02-11 07:13:45

在DynamoDB的partiQl中,当您进行时,从某种东西中选择 * * 表示您希望它查询表格上命名的else elese neshing something sometsing 。您要么需要做以下操作之一:

  • 逃脱。
  • 用引号包围桌子名称,
  • 创建一个带有不同名称的新表格,

我不在计算机前面,或者我会弄清楚它是为您的,但这是我开始的地方。

In PartiQL for DynamoDB, when you do select * from something.else means that you want it to query an index named else on table named something. Either you need to do one of the following:

  • escape the .
  • surround the table name with quotes
  • create a new table with a different name

I am not in front of my computer or i would figure out which it is for you, but this is where I'd start.

很酷不放纵 2025-02-11 07:13:45

这可能是引起问题的原因。

您可以确认

  1. 所使用的访问权限是否有权从DynamoDB表中读取?
  2. AccessKey尚未过期并且可以使用?

这里有一些可以帮助您测试功能的事情,请尝试在〜/.aws/凭据中添加密钥并运行此命令。

aws dynamodb scan --table-name encuesta.encuesta

并确认它确实显示了表内容,并且没有获得访问拒绝的错误。

Here is something that might be causing the problem.

Can you confirm that

  1. the accessKey that you are using have permission to read from the DynamoDB table?
  2. that the accessKey has not expired and can be used?

Here are a few things that can help you test out the functionality try adding the key in ~/.aws/credentials and running this command.

aws dynamodb scan --table-name encuesta.encuesta

and confirm that it is indeed showing up the table content and not getting an access denied error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文