title: TypeError: Cannot read property 'categories' of null
body: <p>My back-end terminal returns <code>null</code> and <code>TypeError: Cannot read property 'categories' of null</code>, what do I lack on my code? It also returns <code>null</code> on my console.log(user) on my controllers</p>
  <p><strong>This is my function:</strong></p>
  <pre><code>function addCategory(e) {
      e.preventDefault();
  
      fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/users`, {
          method: 'POST',
          headers: {
              'Content-Type': 'application/json',
              'Authorization': `Bearer ${localStorage.getItem('token')}`
          },
          body: JSON.stringify({
              name: name,
              description: description,
              type: type,
              amount: amount
          })
      })
      .then(res =&gt; {
          return res.json()
      })
      .then(data =&gt; {
          if (data === true){
              Swal.fire({
                  title: &quot;Category added!&quot;,
                  icon: &quot;success&quot;,
              })
              Router.push('/category')
          } else {
              Router.push('/errors/1')
          }
      })
  }
  </code></pre>
  <p><strong>This is my routes:</strong></p>
  <pre><code>router.post('/', auth.verify, (req, res) =&gt; {
      const user = auth.decode(req.headers.authorization)
      CategoryController.addCategory(req.body)
      .then(result =&gt; res.send(result))
  })
  </code></pre>
  <p><strong>This is my controllers:</strong></p>
  <pre><code>module.exports.addCategory = (params) =&gt; {
      return User.findById(params.userId)
          .then((user, err) =&gt; {
              console.log(user)
              if(err) return false
              user.categories.push(params)
              return user.save()
                  .then((updatedUser, err) =&gt; {
                      return err ? false : true
                  })
                  .catch(err =&gt; {
                      console.log(err)
                  })
          })
          .catch(err =&gt; {
              console.log(err)
          })
  }
  </code></pre>
  <p><strong>This is the terminal error:</strong></p>
  <p><a href="https://i.stack.imgur.com/tZ6VJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tZ6VJ.png" alt="enter image description here" /></a></p>