Display a Note


#1

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

Copied from original issue: https://github.com/AnomalyInnovations/serverless-stack-com/issues/53


#2

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:

TypeError: Failed to fetch

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

Any ideas?


#3

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?


#4

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


#5

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?


#6

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

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


#7

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.


#8

From @AndrewWrightNZ on Fri Sep 15 2017 22:24:26 GMT+0000 (UTC)

@jayair awesome, just reviewed all of the routes and its working :100:


#9

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.

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

instead of

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

#10

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.


#11

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

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


#12

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.


#13

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