Skip to content
Advertisement

Resource not found querying dynamodb

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?

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement