# Display a Note

**URL:** <https://discourse.sst.dev/t/display-a-note/112>\
**Category:** Chapter Comments\
**Created:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112 "2018-05-09T19:18:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112/1 "2018-05-09T19:18:47Z")

</div>

_From @jayair on Mon Apr 10 2017 01:06:45 GMT+0000 (UTC)_  
  
Link to chapter - [http://serverless-stack.com/chapters/display-a-note.html](http://serverless-stack.com/chapters/display-a-note.html)  
  
_Copied from original issue: [https://github.com/AnomalyInnovations/serverless-stack-com/issues/53](https://github.com/AnomalyInnovations/serverless-stack-com/issues/53)_

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112/2 "2018-05-09T19:18:48Z")

</div>

_From @AndrewWrightNZ on Tue Sep 12 2017 05:57:59 GMT+0000 (UTC)_  
  
Hey I can view all notes in the list view on Home.js but when I click on a note I get the error:

```auto
TypeError: Failed to fetch

{message: "Missing Authentication Token"}
message
:
"Missing Authentication Token"

```

Any ideas?

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112/3 "2018-05-09T19:18:49Z")

</div>

_From @jayair on Tue Sep 12 2017 19:42:48 GMT+0000 (UTC)_  
  
@AndrewWrightNZ That’s weird that it’s looking for the token. Can I just do a sanity check and look at your `serverless.yml` for the backend?

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112/4 "2018-05-09T19:18:49Z")

</div>

_From @AndrewWrightNZ on Tue Sep 12 2017 19:44:15 GMT+0000 (UTC)_  
  
@jayair Yeah sure, [https://github.com/AndrewWrightNZ/notes-app-api/blob/master/serverless.yml](https://github.com/AndrewWrightNZ/notes-app-api/blob/master/serverless.yml)

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112/5 "2018-05-09T19:18:49Z")

</div>

_From @jayair on Wed Sep 13 2017 18:51:30 GMT+0000 (UTC)_  
  
@AndrewWrightNZ Yeah that looks okay.

In a previous version of the tutorial we were sending the `userToken` in each of the `invokeApig` calls. Can I see your `Home.js`?

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112/6 "2018-05-09T19:18:49Z")

</div>

_From @AndrewWrightNZ on Thu Sep 14 2017 01:38:51 GMT+0000 (UTC)_  
  
Yeah - [https://github.com/AndrewWrightNZ/notes-app-client/blob/master/src/containers/Home.js](https://github.com/AndrewWrightNZ/notes-app-client/blob/master/src/containers/Home.js)

From a quick google search it may be AWS config related?

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112/7 "2018-05-09T19:18:50Z")

</div>

_From @jayair on Thu Sep 14 2017 18:22:30 GMT+0000 (UTC)_  
  
@AndrewWrightNZ Not sure if this is the right version but I tried your repo and the `invokeApig` call in `Home.js` is making a request to the wrong API endpoint? And there is no `Notes.js`? If you push the updated version I’ll take a look.

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112/8 "2018-05-09T19:18:50Z")

</div>

_From @AndrewWrightNZ on Fri Sep 15 2017 22:24:26 GMT+0000 (UTC)_  
  
@jayair awesome, just reviewed all of the routes and its working 💯

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:18pm UTC](https://discourse.sst.dev/t/display-a-note/112/9 "2018-05-09T19:18:50Z")

</div>

_From @tommedema on Fri Oct 20 2017 06:46:17 GMT+0000 (UTC)_  
  
Is there any reason why some async functions are not defined as async. Is this deliberate?

I.e.

```auto
getNote() {
    return invokeApig({ path: `/notes/${this.props.match.params.id}` });
}

```

instead of

```auto
async getNote() {
    return await invokeApig({ path: `/notes/${this.props.match.params.id}` });
}

```

---

<div class="post-metadata">

**Author:** ![iareintelligent](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/iareintelligent/32/261_2.png) [@iareintelligent](https://discourse.sst.dev/u/iareintelligent)\
**Post date:** [October 15, 2018, 10:32pm UTC](https://discourse.sst.dev/t/display-a-note/112/10 "2018-10-15T22:32:17Z")

</div>

I can get all of my notes using  
_**API.get(“notes”, “/notes”)**_, but using **_API.get(“notes”, `/notes/${this.props.match.params.id}`)_** just returns an empty string w/ no errors.  
(note I have the backticks in there, this text editor is editing them out).

I have verified that the props.match.params thing is returning the correct noteId.

I also want to point out that when I use API.del(“notes”, …params.id) it does properly DELETE the note.

---

<div class="post-metadata">

**Author:** ![jayair](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/jayair/32/9_2.png) [@jayair](https://discourse.sst.dev/u/jayair)\
**Post date:** [October 18, 2018, 7:08pm UTC](https://discourse.sst.dev/t/display-a-note/112/11 "2018-10-18T19:08:03Z")

</div>

For the `/notes/${this.props.match.params.id}` route, can you test it directly using the steps in this chapter?

> **[Test the APIs](https://serverless-stack.com/chapters/test-the-apis.html)**
>
> To test a serverless backend API secured using IAM and Cognito User Pool you need to follow a few steps. First, generate a user token by authenticating with the User Pool. Then use the user token to get a set of temporary IAM credentials using the...

And for the delete case, what happens when you call it?

---

<div class="post-metadata">

**Author:** ![iareintelligent](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/iareintelligent/32/261_2.png) [@iareintelligent](https://discourse.sst.dev/u/iareintelligent)\
**Post date:** [October 18, 2018, 8:25pm UTC](https://discourse.sst.dev/t/display-a-note/112/12 "2018-10-18T20:25:25Z")

</div>

I get a 200 response.

I’m getting a 200 response for everything; including the “get a note”. It’s just returning an empty string instead of a note object.

---

<div class="post-metadata">

**Author:** ![jayair](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/jayair/32/9_2.png) [@jayair](https://discourse.sst.dev/u/jayair)\
**Post date:** [October 28, 2018, 1:48am UTC](https://discourse.sst.dev/t/display-a-note/112/13 "2018-10-28T01:48:29Z")

</div>

Hmm something seems off. Can you compare it to the repo?

> **[AnomalyInnovations/serverless-stack-demo-api](https://github.com/AnomalyInnovations/serverless-stack-demo-api)**
>
> Source for the demo app API in Serverless-Stack.com - AnomalyInnovations/serverless-stack-demo-api

---

<div class="post-metadata">

**Author:** ![tBubble](https://avatars.discourse-cdn.com/v4/letter/t/a88e57/32.png) [@tBubble](https://discourse.sst.dev/u/tBubble)\
**Post date:** [December 13, 2018, 5:35am UTC](https://discourse.sst.dev/t/display-a-note/112/14 "2018-12-13T05:35:17Z")

</div>

Why do I get an error like this when I click on a note?

 ![Capture](https://canada1.discourse-cdn.com/flex032/uploads/serverless_stack/original/1X/d0710aa2a0ea73fac95d6bb45f372760f6e3cfd3.png)

---

<div class="post-metadata">

**Author:** ![jayair](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/jayair/32/9_2.png) [@jayair](https://discourse.sst.dev/u/jayair)\
**Post date:** [December 18, 2018, 12:52am UTC](https://discourse.sst.dev/t/display-a-note/112/15 "2018-12-18T00:52:30Z")

</div>

This seems related to React Router? After which step of the tutorial are you seeing this?

---

<div class="post-metadata">

**Author:** ![tBubble](https://avatars.discourse-cdn.com/v4/letter/t/a88e57/32.png) [@tBubble](https://discourse.sst.dev/u/tBubble)\
**Post date:** [December 19, 2018, 11:46am UTC](https://discourse.sst.dev/t/display-a-note/112/16 "2018-12-19T11:46:11Z")

</div>

Everything worked fine until the front end implementation of render all notes part. But when it comes to displaying a note, this error appears. I have tried changing react-router versions. But it doesn’t seem to work. Thank you so much for spending time to reply. 🙂

---

<div class="post-metadata">

**Author:** ![jayair](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/jayair/32/9_2.png) [@jayair](https://discourse.sst.dev/u/jayair)\
**Post date:** [December 23, 2018, 12:57am UTC](https://discourse.sst.dev/t/display-a-note/112/17 "2018-12-23T00:57:06Z")

</div>

Hmm if that is the case then maybe compare the code you have, specifically this chapter to the one in the repo?

> **[AnomalyInnovations/serverless-stack-demo-client](https://github.com/AnomalyInnovations/serverless-stack-demo-client)**
>
> Source for the demo app client in Serverless-Stack.com - AnomalyInnovations/serverless-stack-demo-client

---

<div class="post-metadata">

**Author:** ![nookale](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/nookale/32/365_2.png) [@nookale](https://discourse.sst.dev/u/nookale)\
**Post date:** [January 7, 2019, 10:51am UTC](https://discourse.sst.dev/t/display-a-note/112/18 "2019-01-07T10:51:44Z")

</div>

Hello,

Thanks for the great tutorial !

I have implemented the “create”, “list”, “get”, “update”, and “delete” functionalities at the client and at the backend and all of them worked fine except “get” which throws the following error messages:

- At the client: \<\<Error: Request failed with status code 500\>\>
- At the backend (CloudWatch Logs): \<\<ValidationException: The provided key element does not match the schema\>\>

Checking futher with CloudWatch Logs I realized that all the entries in the object “event.requestContext.identity” in the “get” lambda function are null except “sourceIp” and “userAgent”:

identity:

```auto
{ cognitoIdentityPoolId: null,
accountId: null,
cognitoIdentityId: null,
caller: null,
sourceIp: 'XXX.XXX.XXX.XXX',
accessKey: null,
cognitoAuthenticationType: null,
cognitoAuthenticationProvider: null,
userArn: null,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',
user: null } 

```

The other “event” objects of the rest of lambdas are filled correctly.

What could it be?

---

<div class="post-metadata">

**Author:** ![jayair](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/jayair/32/9_2.png) [@jayair](https://discourse.sst.dev/u/jayair)\
**Post date:** [January 9, 2019, 12:29am UTC](https://discourse.sst.dev/t/display-a-note/112/19 "2019-01-09T00:29:53Z")

</div>

This sounds like the `get` function is not going through an authentication process. I would check the `serverless.yml` and see if the `authorizer` is set correctly. Especially if it is indented correctly in comparison to the other functions.

> <https://github.com/AnomalyInnovations/serverless-stack-demo-api/blob/master/serverless.yml#L80>

---

<div class="post-metadata">

**Author:** ![nookale](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/nookale/32/365_2.png) [@nookale](https://discourse.sst.dev/u/nookale)\
**Post date:** [January 9, 2019, 7:09am UTC](https://discourse.sst.dev/t/display-a-note/112/20 "2019-01-09T07:09:31Z")

</div>

Hello,

Thanks for the hint.

I have checked both the authorizer and the indentation and they are correct.

Anyway, I have to say that the problem has faded away when entering the second part of the tutorial (Automation) and I have cloned the github repository " serverless-stack-demo-api". While I have not found the root cause for the above mentioned problem, it works properly now and I have decided to move forward.

Thank you very much for your support!

[Next page](https://discourse.sst.dev/t/display-a-note/112.md?page=2)
