Amplify API get request example for listing all items throws an error
See original GitHub issueI followed all the steps in the official doc and when used the code in the example as below replacing the API name and path, it doesn’t return the list, instead it throws 404 error. I haven’t made any manual changes in the API or related Lambda function.
async getData() {
let apiName = 'MyApiName';
let path = '/path';
let myInit = { // OPTIONAL
headers: {} // OPTIONAL
}
return await API.get(apiName, path, myInit);
}
getData();
But, if I pass an id of an existing record with the same request, it returns the object.
Ex.
async getData() {
let apiName = 'MyApiName';
let path = '/path/<id>';
let myInit = { // OPTIONAL
headers: {} // OPTIONAL
}
return await API.get(apiName, path, myInit);
}
getData();
Is there a different way of loading all items?
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (1 by maintainers)
Top Results From Across the Web
API (REST) - Fetching data - JavaScript - AWS Amplify Docs
API status code response > 299 are thrown as an exception. If you need to handle errors managed by your API, work with...
Read more >Cannot reach Amplify CLI-generated Express GET handler ...
So I've created this Amplify REST API with a route called /device . I generated the API with the CRUD function for DynamoDB...
Read more >Troubleshooting and Common Mistakes - AWS AppSync
This section discusses some common errors and how to troubleshoot them. Incorrect DynamoDB Key Mapping. If your GraphQL operation returns the following ...
Read more >HTTP status and error codes for JSON | Cloud Storage
Cloud Storage uses the standard HTTP error reporting format for the JSON API. Successful requests return HTTP status codes in the 2xx range....
Read more >Batching Requests with AWS Amplify and AppSync
Think about the storefront for example: A store owner may need the ... If you're wanting to get up to speed on what...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually, I found out that it is required to add my own get method to scan the database. Added the following function in the app.js file of the Lambda Function. IT IS REQUIRED TO ADD THIS FUNCTION ABOVE OTHER
get
FUNCTIONS.Why is the issue is closed. The behavior is still present. I can’t get a collection of items without the fix which is described in this thread.