title: I get - "TypeError: Client was passed a null or undefined query at Client.query", even though null or undefined is no where in my code
body: <p>I am trying to query the PostgreSQL database with a post request that simply checks for the existence of a <code>username</code> in a <code>users table</code>, if found, the password should be hashed and compared with the one that was queried. I have tested with postman and I get the error message <code>TypeError: Client was passed a null or undefined query at Client.query</code>. I have tested my connectionString with some other HTTP request (like GET) and it worked, which shows that the connectionString is not the problem. Find below a snippet of my code:</p>
  
  <pre><code>router.post("/login", async (req, res, next) =&gt; {
      try {
          // try to find the user first
          const foundUser = await db.query(
              "SELECT * FROM users WHERE username=$1 LIMIT 1"
              [req.body.username]
          );
          if (foundUser.length === 0) {
              return res.json({ message: "Invalid Username" });
          }
           // if the user exists, let's compare their hashed password to a new hash from req.body.password
          const hashedPassword = await bcrypt.compare(
              req.body.password,
              foundUser.rows[0].password
          ); 
      // bcrypt.compare returns a boolean to us, if it is false the passwords did not match!
          if (hashedPassword === false) {
              return res.status(400).json({ message: "Invalid Password" });
          }
          return res.json(200).json({ message: "Logged In" });
      } catch(err) {
          return next(err);
      }
  });
  </code></pre>
  
  <p>The error specified this route/callback as the problem. Any suggestions? </p>