title: Uncaught TypeError: Cannot read property 'uid' of null
body: <p>I don't know why UID returns null. userSessionCheck () contains code to keep the session after login. user.uid gives the same result And Below is my code and error code</p>
  
  <p>--</p>
  
  <h2>Uncaught TypeError: Cannot read property 'uid' of null</h2>
  
  <pre><code>  $(document).ready(function(){
    auth = firebase.auth();
    db = firebase.database();
    storage = firebase.storage();
    userInfo = auth.currentUser;
  
  
    userSessionCheck();
    update_profile();
  
  
    function update_profile() {
  
      var mypage_Ref = db.ref('users/' + userInfo.uid).once('value').then(function(snapshot){
        console.log(snapshot.val());
        profileImageUrl = $('#update_email').val(snapshot.val().profileImageUrl);
        email = $('#update_email').val(snapshot.val().email);
        u_name = $('#update_name').val(snapshot.val().username);
        job = $('#update_job').val(snapshot.val().job);
  
  
        var html =
        '&lt;div class="profile"&gt;' +
         '&lt;img src="'+profileImageUrl+'" id="profile_img"&gt;'+
  
         '&lt;div class="form_g"&gt;'+
           '&lt;label&gt;email&lt;/label&gt;'+
          '&lt;input type="text" style="text-align: center" id="update_email" placeholder="'+ email +'"&gt;'+
         '&lt;/div&gt;'+
         '&lt;div class="form_g"&gt;'+
           '&lt;label&gt;name&lt;/label&gt;'+
           '&lt;input type="text" style="text-align: center" id="update_name" placeholder="'+u_name+'"&gt;'+
         '&lt;/div&gt;'+
         '&lt;div class="form_g"&gt;'+
           '&lt;label&gt;job&lt;/label&gt;'+
           '&lt;h5 id="update_job"&gt;'+job+'&lt;/h5&gt;'+
         '&lt;/div&gt;'+
         '&lt;button type="button" class="s-btn" id="info_submit" style="width: 100%; margin-top: 30px;"&gt;update&lt;/button&gt;'+
        '&lt;/div&gt;';
  
        $('#profile_form').append(html);
  
  
      });
    }
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/d9HAW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d9HAW.png" alt="enter image description here"></a></p>