Give Feedback While Logging In

From @jayair on Mon Apr 10 2017 01:04:36 GMT+0000 (UTC)

Link to chapter - http://serverless-stack.com/chapters/give-feedback-while-logging-in.html

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

Iā€™m having an issue which has surfaced since I implemented the check for current session, my application throws an error when trying to check the session:

TypeError: Cannot read property 'currentSession' of undefined

Iā€™ve checked the documentation on AWS Amplify but it seems to recommend different methods of doing the authentication, any idea where I may have gone wrong?

Does this happen when your app loads? Also, can you show me after which step in the tutorial does the problem show up?

Hey mate I worked out my issue just this morning, I had to recreate my user pool as the old one was causing issues the new one is working fine with identical setup

1 Like

Great! Thanks for reporting back.

Hello!
First of all: Great tutorial! One of the best Iā€™ve read so far.
I found a little bug tho, when you implement the loading state you donā€™t handle the incorrect username / password error so the button keeps spinning indefinetly.
How should we handle that?
Thank you so much!

Sorry I forgot a line when the login fails! I apologize :slight_smile:

1 Like

Thanks for reporting back.

Just wanted to say what a great tutorial this is. I have been going to a bootcamp and you are one of the additional resources that I use. Itā€™s been great. Keep it up!!

1 Like

Thatā€™s awesome! Thanks for the kind words!

Hi,

Great tutorial so far, it would be a great addition in the guide to add how to handle incorrect details response. With the current code it only caters for a successful request. If it is incorrect the button does not handle unsuccessful request causing it to be disabled without being able to exit Logging in animation. :slight_smile:

Yeah we definitely need to add more detail on that. Itā€™ll most likely be an ā€œextra creditā€ chapter, so we donā€™t overload first time readers.

Iā€™m running into an issue that seems to be related to the rest operator (ā€¦props) in the LoaderButton component. The error message is:

ā€œTypeError: Cannot read property ā€˜forEachā€™ of undefinedā€

Removing the references to ā€¦props does away with the error and so Iā€™m able to work around the issue but Iā€™m wondering what is causing it. Any ideas?

1 Like

Thatā€™s really weird! The spread operator is something pretty basic and should be handled by Create React App.

i agree and replaced what you have in Git and still get the same error.

@jayair , this is still not working and tried 3 times now. Going to disable this for the meantime but cant help but think that this could be related to a missing or old library because this happened in a previous chapter using the SPREAD OPERATOR.

Yeah this is super weird. I wonder if something is wrong with the setup on your machine. You should be able to use the spread operator by default.

So, after going through branch 40 (https://branchv40--serverless-stack.netlify.com/chapters/give-feedback-while-logging-in.html), I think I may have skipped a step in setting up my notes client previouslyā€¦ Just dawned on me that my notes client install was done inside the notes API project folder folder rather than its own project folderā€¦ I suspect thats what was causing my issueā€¦ Everything is working great now! Did you happen to do the same?

As to the client project being a subdirectory of the server project, this was not my issue. I went through the tutorial again after the most recent version came out & didnā€™t run into this problem the second time around. Iā€™m still curious as to why the spread operator would produce an error but it may have to remain a mystery.

1 Like

The login flow works great when working locally (npm start) - Butā€¦ when deployed to S3 (Iā€™m hosting a static website / CDN etc) the following happens:

Load the app, press the Login button on the nav bar. Notice the URL changes to /login

now - hit the browser refresh button (command+R). Iā€™m getting a AWS S3 Error XML message. the console shows that S3 returned 403 Forbidden.

Same flow on a local nodejs works great.

Any clue what is the root cause and how to solve this?