DyanmoDB DAX Low level API

139 views Asked by At

Is it possible to print the low level api with DAX client? When I'm using the regular DynamoDB Client its working fine but it isn't working when I'm using DAX client.

DynamoDB Low level API: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.LowLevelAPI.html

example code for printing the low level api:

        const request = this.getDocumentClient().get(getRequest);

        request.on("httpDone", (response) => {
            const debugInfo = {
                retryCount: response.retryCount,
                redirectCount: response.redirectCount,
                headers: response.httpResponse.headers,
            };


        request.send((err: AWSError, data: DocumentClient.GetItemOutput) => {
            if (err) {
                reject(err);
            }
            else {
                resolve(data.Item as T);
            }
        });
1

There are 1 answers

0
David Cohen On BEST ANSWER

Found a solution for this issue, DAX Client is using another event listeners to capture the http calls. Instead of using "httpDone" is should be "complete" Code solution:

const request = this.getDocumentClient().get(getRequest);

    request.on("complete", (response) => {
        const debugInfo = {
            retryCount: response.retryCount,
            redirectCount: response.redirectCount,
            headers: response.httpResponse.headers,
        };


    request.send((err: AWSError, data: DocumentClient.GetItemOutput) => {
        if (err) {
            reject(err);
        }
        else {
            resolve(data.Item as T);
        }
    });