Call the List API

The Amplify library should be handling this automatically. You just need to ensure that you are logging the user in correctly and that mandatorySignIn is set to true.

Wow. I figured out the issue. I had a trailing / on my API Gateway in my config file.

1 Like

Wow that’s annoying. Glad you figured it out.

Hi Jay,

I’m having trouble with the API.get("notes", "/notes"); call.
The front end is throwing this error:

TypeError: Cannot read property 'trim' of undefined

I figured the url for api gateway was misconfigured so I added a trailing ‘/’ to the url in the config file but that throws a network error.

I redeployed my apis and checked the endpoints against what I have in the config file and they match.

Still, the only thing I can think of is that the get request isn’t populating the note object because its not hitting the api properly. Do you have any idea where the problem can be coming from?

Thanks in advance! :slight_smile:

Have you created a note with no content?

1 Like

Yep that was it. Good eye.

For some reason I set the key to ‘note’ in create.js instead of ‘content’ in the API set up.

Thanks for the assist.

1 Like

Hi there,

I have a doubt.

I did everything you did for the pages forms and layouts. So, everything is working fine through the Call the List API, but I realized in the previous step that, apparently I am not sending (or saving) the file in the bucket. The code is exactly the same you posted, so, I think I did something wrong when configuring the API on AWS or setting up the S3 bucket.

I am going to show what is displayed at my S3 page at AWS:

Do you have any ideas of how I can fix this?

Can you inspect the developer console in your browser to see if the request to upload the file is successful?

I am having an issue.

I can create a note and upload it with an attachment no problem. But when I try to list the notes I get a error 500

My config does not have a trailing “/”

1 Like

500 errors are easier to debug because they are usually caused by our own code. I’d enable logging and add some console.log statements to see what is causing it.

Hi, thank you for the amazing tutorial. I have been struggling with a strange bug for some weeks now. The notes will not render unless I navigate away from the page and the hit the back button. Moreover, if I hit the refresh button after I have successfully rendered the notes, they will fail to be rendered again, and I have to leave the page and then return to be able to see them.

Have you experienced this type of behavior before?

Hmm no. Can you post a GIF maybe with what is going on? Also, can you check if the demo version - does the same thing for you?

Hi, thank you for coming back to me. I made a GIF that you can see here - I tried the demo version and it was working as intended.

Hmm that is really weird. Can you try comparing your code to the one in the demo repo?

@jayair if I wanted the create new note button to render on the bottom of the list, how would I go about that?

We do some simple logic to determine where to add the button in the list here -

We check i !== 0 to decide. You can tweak this to move it to the bottom.

Hey again, I am sorry for the late reply. After countless hours of error checking and whatnot, the error has been fixed. I have no idea what I did to fix it, but it is okay now. Thank you again for the amazing work you guys are doing!!

1 Like

I am getting a 403 Error when I try to creat a new note or when i try to display all the notes. I was able to create 2 accounts with my signup page. The only items in my dynamoDB however are the ones we used to test the api before creating the client. I only found this mistake after trying to display all of the notes.

Do you have suggestions where to look to find the problem?

Hmmm so you were able to login but you are not able to create a note or list the notes?

That’s right. I looked at the source code to compare all my code and I only have one .yml file where as the source code has one for the bucket, the dynamoDB, and the User Pool I believe. (Not on my computer atm.) I’m assuming that’s the problem as I did the setup locally for texting of the api so that is different from actually using the api correct?