Getting "TypeError: connect.describeSecurityProfile is not a function" , even though I made sure that everything is similar to Amazon SDK
Getting "TypeError: connect.describeSecurityProfile is not a function" , even though I made sure that everything is similar to Amazon SDK
TypeError: connect.describeSecurityProfile 不是函数
尝试对此进行编码时出现上述错误。 connect.describeUser(参数).承诺();工作正常,但以下代码会引发错误。
let paramaters;
paramaters = {
InstanceId: "",
SecurityProfileId: "",
};
console.log({ paramaters });
let describeSG = await connect.describeSecurityProfile(paramaters).promise();
console.log("describeSG", JSON.stringify(describeSG));
在 v3 SDK 中,您应该实例化 DescribeSecurityProfileCommand
并使用 ConnectClient
的 send()
函数来执行它。 send()
函数 returns 一个 promise,所以你可以使用 async await
。以下是基于可以找到的文档的工作示例 here
import { ConnectClient, DescribeSecurityProfileCommand } from "@aws-sdk/client-connect";
const client = new ConnectClient({ region: "us-west-2" });
const params = {
SecurityProfileId: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
InstanceId: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
};
const command = new DescribeSecurityProfileCommand(params);
const resp = await client.send(command);
console.log(resp);
TypeError: connect.describeSecurityProfile 不是函数 尝试对此进行编码时出现上述错误。 connect.describeUser(参数).承诺();工作正常,但以下代码会引发错误。
let paramaters;
paramaters = {
InstanceId: "",
SecurityProfileId: "",
};
console.log({ paramaters });
let describeSG = await connect.describeSecurityProfile(paramaters).promise();
console.log("describeSG", JSON.stringify(describeSG));
在 v3 SDK 中,您应该实例化 DescribeSecurityProfileCommand
并使用 ConnectClient
的 send()
函数来执行它。 send()
函数 returns 一个 promise,所以你可以使用 async await
。以下是基于可以找到的文档的工作示例 here
import { ConnectClient, DescribeSecurityProfileCommand } from "@aws-sdk/client-connect";
const client = new ConnectClient({ region: "us-west-2" });
const params = {
SecurityProfileId: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
InstanceId: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
};
const command = new DescribeSecurityProfileCommand(params);
const resp = await client.send(command);
console.log(resp);