title: Snowflake - how to connect to Snowflake using NodeJS
body: <p>Does anyone has a working code to connect NodeJS and Snowflake.</p>
  
  <p>Tried following <a href="https://docs.snowflake.net/manuals/user-guide/nodejs-driver-use.html" rel="nofollow noreferrer">instructions for NodeJS</a>: </p>
  
  <pre><code>var snowflake = require('snowflake-sdk');
  
  var connection = snowflake.createConnection({
    account: 'account1',
    username: 'user1',
    password: 'pass1',
    region: 'us-east-1'
  });
  
  connection.connect(function(err, conn) {
    if (err) {
      console.error('Unable to connect: ' + err.message);
    } else {
      console.log('Successfully connected as id: ' + connection.getId());
    }
  });
  </code></pre>
  
  <p>Keep getting errors:</p>
  
  <pre><code>Network error. Could not reach Snowflake.
  </code></pre>
  
  <p>Similarly - following <a href="https://docs.snowflake.net/manuals/user-guide/nodejs-driver-use.html" rel="nofollow noreferrer">instructions for Python</a> works without problem (using EXACT same user/pass/account etc. as for NodeJS):</p>
  
  <pre><code>import snowflake.connector
  
  ctx = snowflake.connector.connect(
      user='user1', 
      password='pass1',
      account='account1'
  )
  
  print ("SELECT current_version():")
  cs = ctx.cursor()
  try:
      cs.execute("SELECT current_version()")
      one = cs.fetchone()
      print(one[0])  # 2.50.2
  finally:
      cs.close()
  </code></pre>