如何使用 opensearch-js 签署请求?

con*_*xyz 5 opensearch node.js

我需要签署 Opensearch 请求。我正在尝试使用opensearch-jsaws-es-connection做到这一点。

\n
import {\n  createAWSConnection,\n  awsGetCredentials,\n} from '@acuris/aws-es-connection';\nimport { Client } from "@opensearch-project/opensearch";\nimport { esConfig } from "./config";\n\nexport const getClient = async () => {\n  const awsCredentials = await awsGetCredentials();\n  const AWSConnection = createAWSConnection(awsCredentials);\n  const client = new Client({\n    ...AWSConnection,\n    node: esConfig.uri\n  });\n  return client;\n};\n
Run Code Online (Sandbox Code Playgroud)\n

但是,此代码抱怨类型与解构...语法不兼容。

\n
S2345: Argument of type '{ node: string; nodes?: string | string[] | NodeOptions | NodeOptions[]; Connection?: typeof Connection; ConnectionPool?: typeof ConnectionPool; ... 26 more ...; caFingerprint?: string; }' is not assignable to parameter of type 'ClientOptions'. \xc2\xa0\xc2\xa0Types of property 'ConnectionPool' are incompatible. \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0Type 'typeof import("/packages/api/node_modules/@elastic/elasticsearch/lib/pool/index").ConnectionPool' is not assignable to type 'typeof import("/packages/api/node_modules/@opensearch-project/opensearch/lib/pool/index").ConnectionPool'. \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0Types of parameters 'opts' and 'opts' are incompatible.\n...\n
Run Code Online (Sandbox Code Playgroud)\n

也许我在解构方面犯了一个愚蠢的错误?是否有其他方式签署请求opensearch-js

\n