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)
The code I am using:
JavaScript
x
25
25
1
export class EncuestaComponent implements OnInit {
2
3
[ ]
4
client: DynamoDBClient = new DynamoDBClient({
5
region : 'eu-west-3',
6
credentials: {
7
accessKeyId: '[REDACTED]',
8
secretAccessKey: '[REDACTED]'
9
}
10
});
11
[ ]
12
onDbClick() {
13
const commandParams = {};
14
const input: BatchExecuteStatementInput = {
15
Statements: [
16
{Statement: "SELECT opciones FROM encuesta.encuesta WHERE id = 'user.1'"}
17
],
18
}
19
const command = new BatchExecuteStatementCommand(input);
20
this.client.send(command).
21
then(data => console.log(data.Responses![0].Error)).
22
catch(error => {console.log("Error"); console.log(error)});
23
}
24
25
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.