title: How can I return a sequelize instance asynchronously?
body: <p>I can't seem to properly pass the <code>sequelize</code> object from the <code>service.js</code> file to the <code>index.js</code> sequelize variable.</p>
  
  <p>Does anything look out of place?</p>
  
  <p><strong>index.js</strong></p>
  
  <pre><code>let sequelize;
  let contractModel;
  
  (async () =&gt; {
      sequelize = await lambdaHelper.init(); //The issue is here
      contractModel = require('./models/Contract')(sequelize, Sequelize); 
  })();
  </code></pre>
  
  <p><strong>service.js</strong></p>
  
  <pre><code>exports.init = async () =&gt; {
      let sequelize = await new Sequelize(process.env.FNI_DATABASE, process.env.FNI_USER, process.env.FNI_PASSWORD, {
          host: process.env.FNI_HOST,
          dialect: 'mysql',
          operatorsAliases: false,
          define: {
              timestamps: false,
              freezeTableName: true
          },
  
          pool: {
              max: 5,
              min: 0,
              acquire: 30000,
              idle: 10000
          }
  
      });
      return sequelize;
  };
  </code></pre>
  
  <p><strong>service2.js</strong>
  The following code works synchronously</p>
  
  <pre><code>exports.init = () =&gt; new Sequelize(process.env.FNI_DATABASE, process.env.FNI_USER, process.env.FNI_PASSWORD, {
      host: process.env.FNI_HOST,
      dialect: 'mysql',
      logging: false,
      operatorsAliases: false,
      define: {
          timestamps: false,
          freezeTableName: true
      },
  
      pool: {
          max: 5,
          min: 0,
          acquire: 30000,
          idle: 10000
      }
  
  });
  </code></pre>
  
  <p><strong>results</strong></p>
  
  <blockquote>
    <p>*********** before *********** (node:66912) UnhandledPromiseRejectionWarning: Unhandled promise rejection
    (rejection id: 1): TypeError: Cannot read property 'findAll' of
    undefined (node:66912) [DEP0018] DeprecationWarning: Unhandled promise
    rejections are deprecated. In the future, promise rejections that are
    not handled will terminate the Node.js process with a non-zero exit
    code.</p>
  </blockquote>
  
  <p><strong>Result2</strong></p>
  
  <blockquote>
    <p>*********** before *********** (node:66540) UnhandledPromiseRejectionWarning: Unhandled promise rejection
    (rejection id: 1): TypeError: Cannot read property 'findAll' of
    undefined (node:66540) [DEP0018] DeprecationWarning: Unhandled promise
    rejections are deprecated. In the future, promise rejections that are
    not handled will terminate the Node.js process with a non-zero exit
    code. Executing (default): SELECT 1+1 AS result TypeError: Cannot read
    property 'define' of undefined
        at module.exports at </p>
  </blockquote>