【问题标题】:Connection to Azure Cosmosdb failed using web socket使用 Web 套接字连接到 Azure Cosmosdb 失败
【发布时间】:2017-08-03 19:24:22
【问题描述】:

我有一个连接到 CosmosDB 以进行一些操作的脚本,我正在使用 CosmosDB 作为 graphDB,但是,我正在使用一个名为 gremlin-secure 的节点模块,它通过 Web 套接字连接到 cosmosDB,但是,最近,我无法连接到数据库如下错误

events.js:160 投掷者; // 未处理的“错误”事件 ^

错误:意外的服务器响应 (200) 在 ClientRequest._req.on (/Users/abshahin/dev/azure-cosmos-db-graph-nodejs-getting-started/node_modules/ws/lib/WebSocket.js:656:26) 在 emitOne (events.js:96:13) 在 ClientRequest.emit (events.js:188:7) 在 HTTPParser.parserOnIncomingClient [作为 onIncoming] (_http_client.js:473:21) 在 HTTPParser.parserOnHeadersComplete (_http_common.js:99:23) 在 TLSSocket.socketOnData (_http_client.js:362:20) 在 emitOne (events.js:96:13) 在 TLSSocket.emit (events.js:188:7) 在 readableAddChunk (_stream_readable.js:176:18) 在 TLSSocket.Readable.push (_stream_readable.js:134:10)

我的代码是这样的

"use strict";

var Gremlin = require('gremlin-secure');
var config = require("./config");

const client = Gremlin.createClient(
    443,
    config.endpoint,
    {
        "session": false,
        "ssl": true,
        "user": `/dbs/${config.database}/colls/${config.collection}`,
        "password": config.primaryKey
    });

client.execute("g.addV('employee').property('id', 'abshahin')", { }, (err, results) => {
    if (err) return console.error(err);
    console.log(JSON.stringify(results));

  });

这是我的配置

var config = {}

config.endpoint = "xxxxxxxx.graphs.azure.com";
config.primaryKey = "super secret key";
config.database = "dbname"
config.collection = "collectionName"

module.exports = config;

我联系了微软,他们建议在这里发帖寻求帮助。

【问题讨论】:

  • 我拿走了你的代码,我无法重现你的问题。您能告诉我们您使用的是哪个版本的gremlin-secure
  • @AaronChen 看来这是 Azure 端的一个问题,它现在也适用于我,不过还是感谢您的帮助。

标签: azure-cosmosdb


【解决方案1】:

检查以确保数据库的 url 看起来像 xxx.graphs.azure.com 在我的情况下,Azure 门户中显示的 ulr 不正确。

【讨论】:

    【解决方案2】:

    这看起来有点类似于a problem I faced recently。确保您拥有最新的 OpenSSL 版本

    openssl version -a
    

    Azure CosmosDB 强制实施 SSL/TLS 1.2,旧版本的 OpenSSL 不支持此功能

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-07
      • 2021-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-26
      相关资源
      最近更新 更多