title: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
body: <p>Ive read documentation from several pages on SO of this issue, but i havent been able to fix my issue with this particular error.</p>
  <pre><code>    throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string')
      ^
  
  Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
      at Object.continueSession (C:\Users\CNFis\Desktop\WulfDevelopments\ThePantry\node_modules\pg\lib\sasl.js:24:11)
      at Client._handleAuthSASLContinue (C:\Users\CNFis\Desktop\WulfDevelopments\ThePantry\node_modules\pg\lib\client.js:257:10)
      at Connection.emit (events.js:400:28)
      at C:\Users\CNFis\Desktop\WulfDevelopments\ThePantry\node_modules\pg\lib\connection.js:114:12
      at Parser.parse (C:\Users\CNFis\Desktop\WulfDevelopments\ThePantry\node_modules\pg-protocol\dist\parser.js:40:17)
      at Socket.&lt;anonymous&gt; (C:\Users\CNFis\Desktop\WulfDevelopments\ThePantry\node_modules\pg-protocol\dist\index.js:11:42)
      at Socket.emit (events.js:400:28)
      at addChunk (internal/streams/readable.js:290:12)
      at readableAddChunk (internal/streams/readable.js:265:9)
      at Socket.Readable.push (internal/streams/readable.js:204:10)
  </code></pre>
  <p>its as if in my <code>connectDB()</code> function its not recognizing the password to the database. I am trying to run a <code>seeder.js</code> script to seed the database with useful information for testing purposes, and if i run <code>npm run server</code> which is a script that just starts a nodemon server, itll connect to the DB just fine. but when i try to run my script to seed data, i am returning this error.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import { Sequelize } from "sequelize";
  import colors from "colors";
  import dotenv from "dotenv";
  
  dotenv.config();
  
  const user = "postgres";
  const host = "localhost";
  const database = "thePantry";
  const port = "5432";
  
  const connectDB = async () =&gt; {
    const sequelize = new Sequelize(database, user, process.env.DBPASS, {
      host,
      port,
      dialect: "postgres",
      logging: false,
    });
    try {
      await sequelize.authenticate();
      console.log("Connection has been established successfully.".bgGreen.black);
    } catch (error) {
      console.error("Unable to connect to the database:".bgRed.black, error);
    }
  };
  
  export default connectDB;</code></pre>
  </div>
  </div>
  </p>
  <p>above is my connectDB() file, and again, it works when i run the server normally. but i receive this error only when trying to seed the database. Ill post my seeder script below:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import dotenv from "dotenv";
  import colors from "colors";
  import users from "./data/users.js";
  
  import User from "./models/userModel.js";
  
  import connectDB from "./config/db.js";
  
  dotenv.config();
  console.log(process.env.DBPASS);
  
  connectDB();
  
  const importData = async () =&gt; {
    try {
      await User.drop();
      await User.sync();
  
      await User.bulkCreate(users);
  
      console.log("Data Imported".green.inverse);
      process.exit();
    } catch (e) {
      console.error(`${e}`.red.inverse);
      process.exit(1);
    }
  };
  
  const destroyData = async () =&gt; {
    try {
      await User.bulkDestroy();
  
      console.log("Data Destroyed".red.inverse);
      process.exit();
    } catch (e) {
      console.error(`${e}`.red.inverse);
      process.exit(1);
    }
  };
  
  if (process.argv[2] === "-d") {
    destroyData();
  } else {
    importData();
  }</code></pre>
  </div>
  </div>
  </p>