Home > Enterprise >  Getting "TypeError: connect.describeSecurityProfile is not a function" , even though I mad
Getting "TypeError: connect.describeSecurityProfile is not a function" , even though I mad

Time:12-18

TypeError: connect.describeSecurityProfile is not a function Getting the above-mentioned error when trying to code this. connect.describeUser(params).promise(); is working fine but the following code throws error.

let paramaters;
        paramaters = {
            InstanceId: "",
            SecurityProfileId: "",
        };
        console.log({ paramaters });
        let describeSG = await connect.describeSecurityProfile(paramaters).promise();
        console.log("describeSG", JSON.stringify(describeSG));

CodePudding user response:

In the v3 SDK you should instantiate DescribeSecurityProfileCommand and use the send() function of ConnectClient to execute it. The send() function returns a promise, so you can use async await. The following is a working example based on the docs that can be found 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);
  • Related