# Render the Note Form

**URL:** <https://discourse.sst.dev/t/render-the-note-form/140>\
**Category:** Chapter Comments\
**Created:** [May 9, 2018, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140 "2018-05-09T20:06:21Z")\
**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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/1 "2018-05-09T20:06:21Z")

</div>

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

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/2 "2018-05-09T20:06:22Z")

</div>

_From @mikhaelbendavid on Wed Jul 26 2017 06:55:14 GMT+0000 (UTC)_  
  
When I click a note to examine, the page redirects to prod/notes/undefined - and I get an error. Trying to figure out why the pushed link is undefined, instead of the dynamo db note id.

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/3 "2018-05-09T20:06:23Z")

</div>

_From @jayair on Wed Jul 26 2017 17:13:45 GMT+0000 (UTC)_  
  
@mikhaelbendavid You can check what is being returned by adding a `console.log` here - [https://github.com/AnomalyInnovations/serverless-stack-demo-client/blob/render-the-note-form/src/containers/Home.js#L31](https://github.com/AnomalyInnovations/serverless-stack-demo-client/blob/render-the-note-form/src/containers/Home.js#L31).

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/4 "2018-05-09T20:06:23Z")

</div>

_From @RaphaelMui on Wed Aug 09 2017 09:25:02 GMT+0000 (UTC)_  
  
When I click one of my note, a status code 500 returned.

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/5 "2018-05-09T20:06:23Z")

</div>

_From @jayair on Wed Aug 09 2017 17:23:03 GMT+0000 (UTC)_  
  
@RaphaelMui The 500 error should be something we are generating. Make sure the link for the note looks right. You can also check your CloudWatch logs for the error.

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/6 "2018-05-09T20:06:23Z")

</div>

_From @RaphaelMui on Thu Aug 10 2017 08:36:32 GMT+0000 (UTC)_  
  
@jayair The Request URL is [https://uy6essyal3.execute-api.us-east-1.amazonaws.com/prod/notes/9704e3b0-7d82-11e7-9f52-abe788a40b9a](https://uy6essyal3.execute-api.us-east-1.amazonaws.com/prod/notes/9704e3b0-7d82-11e7-9f52-abe788a40b9a)

From the CloudWatch logs,

```auto
2017-08-10T08:13:34.778Z	cd8bc624-7da3-11e7-a4d5-bf4a01ad26b2	ReferenceError: error is not defined
at _callee$ (/var/task/get.js:199:27)
at tryCatch (/var/task/node_modules/regenerator-runtime/runtime.js:65:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/var/task/node_modules/regenerator-runtime/runtime.js:303:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/var/task/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/var/task/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /var/task/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
at process._tickDomainCallback (internal/process/next_tick.js:135:7)

```

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/7 "2018-05-09T20:06:24Z")

</div>

_From @jayair on Thu Aug 10 2017 23:13:43 GMT+0000 (UTC)_  
  
@RaphaelMui Hmm that seems a bit cryptic. Can you try adding some debug message? For example, you can add a `console.log` before this line - [https://github.com/AnomalyInnovations/serverless-stack-demo-api/blob/master/get.js#L27](https://github.com/AnomalyInnovations/serverless-stack-demo-api/blob/master/get.js#L27)

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/8 "2018-05-09T20:06:24Z")

</div>

_From @inventanew on Thu Dec 07 2017 19:43:48 GMT+0000 (UTC)_  
  
I’m getting this error…  
./src/containers/Notes  
Module build failed: Error: ENOENT: no such file or directory, open

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/9 "2018-05-09T20:06:24Z")

</div>

_From @jayair on Mon Dec 11 2017 11:43:54 GMT+0000 (UTC)_  
  
@inventanew Seems like that file might not be in the right location?

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/10 "2018-05-09T20:06:24Z")

</div>

_From @mdhendri on Thu Mar 22 2018 05:09:01 GMT+0000 (UTC)_  
  
With the demo app I am getting the following error “This XML file does not appear to have any style information associated with it. The document tree is shown below.” Why is this happening? I am also seeing this with my local app. It seems like the URL may be miss formed.

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/11 "2018-05-09T20:06:25Z")

</div>

_From @jayair on Thu Mar 22 2018 17:08:13 GMT+0000 (UTC)_  
  
@mdhendri Which page of the demo app are you seeing this on - [https://demo.serverless-stack.com](https://demo.serverless-stack.com)?

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/12 "2018-05-09T20:06:25Z")

</div>

_From @mdhendri on Thu Mar 22 2018 17:15:44 GMT+0000 (UTC)_  
  
Yes, the issue was on [https://demo.serverless-stack.com](https://demo.serverless-stack.com) and also my own  
app. It seems that if there was an image in the S3 bucket prior to the  
switch to AWS Amplify somehow the URL got messed up and hence the error.  
If I uploaded another image then it seemed to resolve itself. The  
interesting thing is I tried it again this morning and I don’t get that XML  
error.

On Thu, Mar 22, 2018 at 10:08 AM, Jay V [notifications@github.com](mailto:notifications@github.com) wrote:

> @mdhendri [https://github.com/mdhendri](https://github.com/mdhendri) Which page of the demo app are  
> you seeing this on - [https://demo.serverless-stack.com](https://demo.serverless-stack.com)?
> 
> —  
> You are receiving this because you were mentioned.  
> Reply to this email directly, view it on GitHub  
> [https://github.com/AnomalyInnovations/serverless-stack-com/issues/54#issuecomment-375383851](https://github.com/AnomalyInnovations/serverless-stack-com/issues/54#issuecomment-375383851),  
> or mute the thread  
> [https://github.com/notifications/unsubscribe-auth/AASDy0AIURhvFRknobnL-m7dcw-\_dEqXks5tg9p-gaJpZM4M4OMo](https://github.com/notifications/unsubscribe-auth/AASDy0AIURhvFRknobnL-m7dcw-_dEqXks5tg9p-gaJpZM4M4OMo)  
> .

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/13 "2018-05-09T20:06:25Z")

</div>

_From @iggirex on Fri Mar 30 2018 19:06:02 GMT+0000 (UTC)_  
  
How does wrapping JSX html code inside curly braces work? This line:

```auto
{this.state.note &&
        <form onSubmit={this.handleSubmit}>

```

Doesn’t the && symbol make this a conditional statement? Wouldn’t it just return a boolean? The instructions say “We render our form only when this.state.note is available.” Is this the line that does that? How does && work here?

---

<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, 8:06pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/14 "2018-05-09T20:06:25Z")

</div>

_From @jayair on Fri Mar 30 2018 22:36:17 GMT+0000 (UTC)_  
  
@iggirex Yeah JSX is a bit confusing. One way to think about it is that React converts JSX into a set of standard JS calls to create components. In this case, if `this.state.note` is not null (or false), it’ll return the React component called `form`. If it’s null then it won’t render anything.

Here is some info on how `false` is rendered in JSX - [https://reactjs.org/docs/conditional-rendering.html#inline-if-with-logical--operator](https://reactjs.org/docs/conditional-rendering.html#inline-if-with-logical--operator).

---

<div class="post-metadata">

**Author:** ![hoyere](https://avatars.discourse-cdn.com/v4/letter/h/6bbea6/32.png) [@hoyere](https://discourse.sst.dev/u/hoyere)\
**Post date:** [April 10, 2019, 4:43pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/15 "2019-04-10T16:43:11Z")

</div>

This link doesn’t go anywhere. I am getting this same error. [http://localhost:3000/notes/undefined](http://localhost:3000/notes/undefined) Network Error

edit…I figured it out, but now it is giving me No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

edit…So I downloaded a chrome extension that lets me get past No ‘Access-Control-Allow-Origin’ header is present on the requested resource, SO said it had something to do with local machine on browser conflict. But now when I click the link it is a blank container.

Any ideas?

---

<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:** [April 11, 2019, 11:55pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/18 "2019-04-11T23:55:00Z")

</div>

This sounds like the API to get the note isn’t returning properly? Can you confirm this by adding a `console.log` for what it returns?

---

<div class="post-metadata">

**Author:** ![jordanmaurice](https://avatars.discourse-cdn.com/v4/letter/j/9de053/32.png) [@jordanmaurice](https://discourse.sst.dev/u/jordanmaurice)\
**Post date:** [August 5, 2019, 1:56am UTC](https://discourse.sst.dev/t/render-the-note-form/140/19 "2019-08-05T01:56:58Z")

</div>

I’m currently getting an error when rendering the note page.

Error: Request failed with status code 500

I have made sure that my Note.js matches the tutorial.

My get.js in the back end correctly works when using the mock/get-event.json test.

Any idea why its not loading? It does load all the notes correctly on the index page.

Other items I’ve done to test:  
Verified that the list functions work as expected  
Updated get-event.json to use the notes created from the app, those return okay as well, so the API works with testing from other data as well… Really lost on this one.

Edit:  
After much trial and error, soul searching, and meandering the internet, the issue existed within my serverless.yml file. The get function had a line; authorize: aws\_iam instead of authorizer: aws\_iam.

So there you have it! Hope this helps someone else.

---

<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:** [August 7, 2019, 5:58pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/20 "2019-08-07T17:58:38Z")

</div>

Wow that’s unfortunate. I wish Lambda gave better error messages.

---

<div class="post-metadata">

**Author:** ![nevoah](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@nevoah](https://discourse.sst.dev/u/nevoah)\
**Post date:** [August 1, 2020, 4:27am UTC](https://discourse.sst.dev/t/render-the-note-form/140/21 "2020-08-01T04:27:05Z")

</div>

Hey there, hoping you might be able to help. As others have mentioned, the links in my note list are /undefined, and I’m getting a 500 error when clicking through. Console log is as follows:

```
index.js:1 Warning: Each child in a list should have a unique "key" prop.

Check the render method of `Home`. 
    in withRouter(LinkContainer) (at Home.js:43)
    in Home (at Routes.js:14)
    in Route (at Routes.js:13)
    in Switch (at Routes.js:12)
    in Routes (at App.js:68)
    in div (at App.js:41)
    in App (at src/index.js:37)
    in Router (created by BrowserRouter)
    in BrowserRouter (at src/index.js:36)
```

---

<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:** [August 1, 2020, 6:41pm UTC](https://discourse.sst.dev/t/render-the-note-form/140/22 "2020-08-01T18:41:07Z")

</div>

So this warning is saying that the list of notes doesn’t have a unique id in this line:

> <https://github.com/AnomalyInnovations/serverless-stack-demo-client/blob/master/src/containers/Home.js#L42>

It looks like the backend isn’t returning this properly. Check your API response and make sure that there is a `noteId` in it.

[Next page](https://discourse.sst.dev/t/render-the-note-form/140.md?page=2)
