Unable to locate the resource when trying to query DynamoDB

I am having trouble accessing a DynamoDb table, as I keep encountering a "Resource not found" error.

The table is set up like this; it's Active and located in the Paris Region (eu-west-3).

https://i.sstatic.net/W0IZs.png

This is the code snippet 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)});
  }

Upon checking the console, it appears that the then method was executed, but the output message says {Code: 'ResourceNotFound', Message: 'Requested resource not found'}

Can anyone spot what might be going wrong here?

Answer №1

If you're using PartiQL for DynamoDB, running select * from something.else indicates that you want to query an index named else on a table named something. In order to make this work, you have a few options:

  • Escape the period in the table name.
  • Enclose the table name in quotes.
  • Create a new table with a different name.

Unfortunately, I'm not currently at my computer or else I would look into which solution is needed in your specific case. This should give you a good starting point, though.

Answer №2

It seems there could be a potential cause of the issue at hand.

Could you verify if

  1. the accessKey being used has appropriate permissions to read from the DynamoDB table?
  2. the accessKey is still valid and not expired?

To test the functionality, consider adding the key in ~/.aws/credentials and executing the following command:

aws dynamodb scan --table-name encuesta.encuesta

Check that the table content is displayed and no access denied error occurs.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble with my Express.js logout route not redirecting, how can I troubleshoot and resolve it?

The issue with the logout route not working persists even when attempting to use another route, as it fails to render or redirect to that specific route. However, the console.log("am clicked"); function works perfectly fine. const express = require('e ...

Modify class or id of element according to the parent element's class in JavaScript

Is there a way to update the class of a child element based on the parent element's class? For instance <div class="change"> <div class="show-more"></div> </div> If the parent has class="change", then change the child&ap ...

utilizing vuex store within a JavaScript document

Currently, I'm encountering an issue while attempting to access my store from a helper function file: import store from '../store' let auth = store.getters.config.urls.auth An error is being logged: Uncaught TypeError: Cannot read prop ...

Why do Material UI components fail to render in jsdom while using Jest?

During my UI testing using Jest/React Testing Library, I encountered a peculiar issue. In one of my components, the return statement is structured as follows: const sidebarContentUp = ( <Drawer anchor="left" onClose={onMobileC ...

How can I read "binary" characters from a file using JavaScript?

When I mention binary, I'm referring to ghjkl54╞←‼╝454┴ rather than 10101110. I am interested in implementing a tilemap loading functionality in JavaScript without having to redo my map editor, which is coded in Java and exports maps as bin ...

Maximizing the performance of plotting hundreds or thousands of series in a 2D scatter or line chart using Echarts

Plotting a large data set with hundreds or thousands of series using Echarts has proven to be slow and challenging to manage. If you take a look at the example code provided in this large and progressive options on single series instead of all plotted se ...

Errors encountered in the ajax request, specifically 404 and 401 errors

Using jQuery's ajax method, I am submitting an ajax request in the following manner: $.ajax({ type: "PUT", url: specifiedURL, contentType: "application/json", data: JSON.stringify(data), dataType: "json" ...

Buttons in Highcharts

Is there a way to incorporate a button within a highcharts graph? I am working with a bar chart and would like to include a button on the left side of the label, similar to the example shown in this bar chart demo. I want the button to appear before the ...

How to parse JSON in JavaScript/jQuery while preserving the original order

Below is a json object that I have. var json1 = {"00" : "00", "15" : "15", "30" : "30", "45" : "45"}; I am trying to populate a select element using the above json in the following way. var selElem = $('<select>', {'name' : nam ...

Ways to store a JSON string in a variable

When utilizing the ajax function, I am able to retrieve my JSON string. Here is an example: $.ajax({ type: "POST", url: "http://localhost/./Service/GetPageInfo", dataType: "json", contentType: 'application/json' ...

Why are the radio buttons not aligned with the text in the center?

Currently, I am in the process of building a form that includes radio buttons. However, I've encountered an issue where the text next to the radio buttons appears on a different level than the buttons themselves. How can I go about fixing this partic ...

loading JSON file using dynamic JavaScript techniques

My Raspberry Pi is running a C++ application in the background that performs complex mathematical calculations based on sensor input and generates results every second. I want to showcase this data on a website by having the application create a JSON file ...

Is there a way to refresh a specific element without having to reload the entire page when the button is clicked

While working on a rock, paper, scissors game in JavaScript, I found it tedious to have to constantly reload the page after each play. To solve this issue, I attempted to add a button that would reset the game for a new round. However, I encountered an err ...

Jasmine encountered an error while trying to compare the same string: 'Expected the values to match.'

I'm encountering an error message, despite verifying that the strings are identical: Expected { $$state : { status : 1, value : { customerNumber : 'customerNumber', name : 'name', userId : 'buId', customerType : 'ty ...

Fadein and FadeOut Div transitions are operating correctly in a loop, however, the initial DIV is not being displayed

Why is the first DIV not fading in at all when I have 3 divs set to fade in and out? I'm confident that my code is correct, any ideas? My jQuery/Javascript code: <script type="text/javascript"> $(document).ready(function() { function fade( ...

Dealing with an unspecified parameter can be tricky - here's how you

Currently, I am in the process of developing an angular application. In this project, there is a specific scenario that needs to be handled where a parameter is undefined. Here's a snippet of my code: myImage() { console.log('test') ...

Echo a JS variable into PHP and then insert a PHP file into an HTML element - a step-by-step guide!

Greetings to the wonderful community at stackoverflow, I am currently working on a variable code that allows for easy insertion of code from another file, such as a div. I am curious if it is possible to include a PHP file using JavaScript and JS variable ...

What is the best way to implement a dropdown menu with JavaScript or jQuery?

I'm looking to create a dynamic dropdown list using Javascript or JQuery that mirrors the functionality of selecting countries, states, and cities. Can someone provide guidance on the best code to achieve this? Below is a snippet of my existing code: ...

Notifying the view with a SignalR message from the controller upon event trigger

Just starting out with SignalR and attempting to set up a notification for a specific event triggered by an API. What I've attempted: Hub: public class NotificationHub : Hub { private static IHubContext hubContext = GlobalHost.Connectio ...

Uh-oh! Trouble loading web app dependencies: 404 Error

Currently, I have a functional SailsJS boilerplate application. The next step I am trying to undertake involves integrating Angular-Material as a dependency in order to kickstart some UI development tasks. However... After installing angular-material usin ...