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?