I was getting the (Chrome) console message that
'googleUser' is undefined while completing Chapter 4, even though the Google login seemed to proceed correctly i.e. the button said ‘Signed in’ after completing the dialog interaction.
I got past the error by prepending the following code to the googleSignIn() function declaration:
// Added this next line, as per: http://stackoverflow.com/a/42298059 const googleUser = gapi.auth2.getAuthInstance().currentUser.get();