Snowflake nodejs 驱动程序 returns 无法连接:网络错误。无法联系到雪花

Snowflake nodejs driver returns Unable to connect: Network error. Could not reach Snowflake

我正在通过 VPN 连接使用雪花,需要在 nodejs 项目上设置雪花。 我遵循了 https://docs.snowflake.com/en/user-guide/nodejs-driver-use.html# 文档中提到的这些步骤。

  1. nodejs版本v12.18.0
  2. 已安装 snowflake-sdk(版本 1.6.1)
const snowflake = require('snowflake-sdk');
snowflake.configure({ ocspFailOpen: false });

const snowflakeDatabase = {
    accessUrl:
        'https://xyz.region.privatelink.snowflakecomputing.com:7756',
    account: 'xyz.region.privatelink',
    authenticator: 'SNOWFLAKE',
    username: 'my_user_name',
    password: 'my_password',
    insecureConnect: true,
    clientSessionKeepAlive: true,
    jsTreatIntegerAsBigInt: true,
};

connection = snowflake.createConnection(snowflakeDatabase);

createPool = () => {
    if (!connection) {
        connection = snowflake.createConnection(snowflakeDatabase);
    }

    if (!connection.isUp()) {
        connection.connect(function (err, conn) {
            if (err) {
                console.error('Unable to connect: ' + err.message);
            } else {
                console.log('Successfully connected to Snowflake.');
                // Optional: store the connection ID.
                connection_ID = conn.getId();
            }
        });
        console.log('connection status:', connection.isUp());
    }

    return connection;
};

closePool = () => {
    connection.destroy(function (err, conn) {
        if (err) {
            console.error('Unable to disconnect: ' + err.message);
        } else {
            console.log(
                'Disconnected connection with id: ' + connection.getId()
            );
        }
    });
};

module.exports = {
    createPool: createPool,
    closePool: closePool,
};

但它 returns 响应

(node:10188) UnhandledPromiseRejectionWarning: OperationFailedError: IP {{IP_ADDRESS}} is not allowed to access Snowflake.  Contact your local security administrator.
    at createError (myfolder\node_modules\snowflake-sdk\lib\errors.js:529:15)
    at Object.exports.createOperationFailedError (myfolder\node_modules\snowflake-sdk\lib\errors.js:308:10)
    at Object.callback (myfolder\node_modules\snowflake-sdk\lib\services\sf.js:624:28)
    at Request.<anonymous> (myfolder\node_modules\snowflake-sdk\lib\http\base.js:107:19)
    at Request._callback (myfolder\node_modules\lodash\lodash.js:10118:25)
    at Request.requestRetryReply [as reply] (myfolder\node_modules\requestretry\index.js:115:19)
    at Request.<anonymous> (myfolder\node_modules\requestretry\index.js:156:10)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:10188) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10188) [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.

这里我使用了 VPN 连接,我已经有 .pem 文件到我的组织 VPC。我使用以下 ssh 命令来创建 ssh 隧道。

ssh -L 7756:xyz.region.privatelink.snowflakecomputing.com:443 -l user_name -N server_name -p port_number -i my_file.pem

请帮忙解决这个问题

您的 IP 似乎在 Snowflake 的网络策略中被阻止或不允许。您可以联系具有 AccountAdmin/SecurityAdmin 权限的用户以允许您在 Snowflake 中使用您的 IP 吗?

参考:https://docs.snowflake.com/en/user-guide/network-policies.html