1
votes

I am using the sample code provided by Snowflake for connecting with Node.js driver, but keep getting following errors:

"Unable to connect: Incorrect username or password was specified."
"Cannot read property getPeerCertificate of null"

I've also tried the old way where region is provided as a separate parameter and account is xyz12345 instead of xyz.region.azure

Node.js, not working

var snowflake = require('snowflake-sdk');

var connection = snowflake.createConnection({  

    account: 'xyz12345.region.azure',  
    username: 'username',  
    password: 'password' 

});


connection.connect(function(err, conn) {
    if (err) {
        console.error('Unable to connect: ' + err.message);
    } else {
        console.log('Successfully connected as id: ' + connection.getId());
    }
});

Python, working

import os
import sys
import json
import snowflake.connector

ctx = snowflake.connector.connect(
user='username',
password='password',
account='xyz12345.region.azure'
)

cs = ctx.cursor()

cs.execute("SQL statement")

I have the exact same parameters in equivalent python script, which works perfectly. And yes, I've triple checked that the username and password are correct, and I've tried different accounts, none of which work.

Is anyone experiencing with similar problems?

1

1 Answers

1
votes

Try this:

var connection = snowflake.createConnection({
    account:  'xyz12345',
    username: 'username',
    password: 'password',
    region:   'region.azure'
});

There is a known issue in NodeJS driver. account cannot include region yet.