title: Each key must be a number of string; got undefined
body: <p>When I try to access a function, findpen() I am getting an error:</p>
  
  <blockquote>
    <p>each key must be a number of string; got undefined.</p>
  </blockquote>
  
  <p>Can someone please help? Is there any problem in declaring variable?</p>
  
  <pre><code>var mysql = require('../../node_modules/mysql');
  describe ('protractor Demo', function() {
  
  it ('login',function(done)
  {
   ............
   ............
   Console.log ('login sucess')
  });
  
  it('E2E',function(done) 
  {     
       var ofrecord = findPen();    
       browser.sleep(12000);  
       browser.element(by.css('div &gt; input')).sendKeys(ofrecord);
       browser.actions().sendKeys(protractor.Key.ENTER).perform().then(function()
  {
       console.log('reference # is searched sucessfully');
  })
  
  var accountnumber;
  function findPen() 
  {
      var connection = mysql.createConnection
  ({
      host: 'host',
      user :'user',
      password :'password',
      database:'database'
  });  
      connection.connect(function(){
      console.log('DB is connected');    
  }); 
       connection.query("SELECT * from  TEST where TEST Descrption='TCRC' LIMIT 1",function(err,rows) 
      {
      if (!err) 
      {
      console.log("result is :", rows[0].Tentacles);
      accountnumber=rows[0].Tentacles;
      console.log("output is :", accountnumber);
      return accountnumber;
      }         
      else
      {
      console.log("Error"+err)
      }
       });
  
  }
  </code></pre>