Need help with backend challenge - build a voting app

So I’ve been doing the build a voting app challenge for a while and I finished the signup & login part, but then I ran into a problem that I don’t understand why it happens:

whenever I try to go to the “polls” section, it gave me an error of:

    1| <%include header.ejs %>
 >> 2| <%include nav.ejs %>
    3| <div id = "home" class = "container">
    4|     <h1>Polls</h1>
    5| </div>

esc is not a function

PS lines 1~5 is everything I have in my polls.ejs file
and here is my code for the polls.js file:

const express = require('express');
const router = express.Router();

router.get('/', function (req, res) {
    res.render('polls');
});

module.exports = router;

and here is my code for the nav.ejs file:

  <body>
    <header>
        <nav class="navbar navbar-dark navbar-full navbar-fixed-top" style="background-color: #0099ff;">
          <div class="container">
            <% if(authenticated === false){ %>
              <a  id="title" class="navbar-brand" href="/" style="color: #dddddd">FFC Voting App</a>
            <ul class="nav navbar-nav pull-sm-right" style = "float: right;">
              <li class="nav-item active"><a class="nav-link" href="/polls">Polls</a></li>
              <li class="nav-item"><a class="nav-link" href="/login">Login In</a></li>
              <li class="nav-item"><a class="nav-link" href="/signup">Sign Up</a></li>
            </ul>
          <% }else{ %>
              <a  id="title" class="navbar-brand" href="/" style="color: #dddddd">FFC Voting App</a>
            <ul class="nav navbar-nav pull-sm-right" style = "float: right;">
              <li class="nav-item active"><a class="nav-link" href="/polls">Polls</a></li>
              <li class="nav-item"><a class="nav-link" href="/mypolls">My Polls</a></li>
              <li class="nav-item"><a class="nav-link" href="/">Logout</a></li>
            </ul>
          <%}%>
          </div>
        </nav>
      </header>
  </body>

The strange thing here is that if I take out the if/ else statement, it works perfectly fine, but when I add it on, it gives me the error.
Does anyone know why it happens and how I can solve it?

What are you using to “authenticate” users? looks like the “authenticate” variable isn’t set in the response body.

What’s in header.ejs? Can you link to your project files?