JavaScript SDK – Troubleshooting

Logging

Chat SDK logs the errors, warnings and other information which can be useful when investigating an issue.

Chat SDK logs information to the browser's console. By default the SDK log level is set to WARN. The SDK's log level can be set during init() and anytime using the setLogLevel() method. For the complete list of Log Levels, refer to the documentation provided inside the Chat SDK package, more details here.

The logs will have the information regarding the error and the information before and after the error. During the error evaluation, set the log level to DEBUG to get the maximum details.

AvayaCCaaSChatSDK.setLogLevel("DEBUG");

📘

Info

When reporting issues to support, it is necessary to provide all the logs related to the SDK without any truncation/modification. The SDK logs can be identified by the @ Avaya CCaaS Chat SDK string contained in them.

Example :

Fri Aug 12 2022 22:03:07 GMT+0530 (India Standard Time) @ Avaya CCaaS Chat SDK [DEBUG] : Avaya Experience Platform™ Chat SDK initialized

🚧

Warning

While sending the logs to support, it is important to remove all the sensitive information if any.

Error Handling

Most of the SDK's methods are asynchronous hence the Promise returned by them will be rejected with the error details in case an error occurs. The synchronous methods will throw an error.

Chat SDK raises the ACSException which encapsulates the SDK specific errors. ACSException extends the JavaScript's Error class, hence along with all the Error specific methods it provides one additional field namely - code. The message field of the Error object provides brief information regarding the error. Each SDK specific error has an unique error code of format ACS-3XX.

For the complete list of error codes, refer to the documentation provided inside the Chat SDK package, more details here.

// Synchronous methods
try {
    AvayaCCaaSChatSDK.getEngagementById(1);
} catch (error) {
    // Handle the error.
    console.log(error.code, error.message);
}


// Asynchronous methods
AvayaCCaaSChatSDK.init().catch((error) => {
    // Handle the error.
    console.log(error.code, error.message);
});

try {
    const userContext = await AvayaCCaaSChatSDK.init();
} catch(error) {
    console.log(error.code, error.message);
}

Troubleshooting common issues

Some of the common issues and how to troubleshoot them.

AvayaCCaaSChatSDK variable is not defined

This can happen if the avaya-ccaas-chat-sdk.js file is not imported properly due to either an incorrect path or importing it as module. Make sure you import the file as a normal JavaScript file and not a module.

<script src="/path/to/avaya-ccaas-chat-sdk.js"></script>

FAQs