awslabs / amazon-qldb-driver-nodejs

A NodeJs implementation of a driver for Amazon QLDB.
https://aws.amazon.com/qldb/?nc2=h_ql_prod_db_qldb
Apache License 2.0
53 stars 22 forks source link

Seeing "getRetryLimit is not a function" sporadically in logs #635

Closed normand1 closed 9 months ago

normand1 commented 9 months ago

I'm sporadically seeing this error in my lambda logs where I invoke the qldb client:

retryConfig.getRetryLimit is not a function","stack":"TypeError: retryConfig.getRetryLimit is not a function\n at QldbDriver.<anonymous> (/var/task/node_modules/amazon-qldb-driver-nodejs/dist/src/QldbDriver.js:183:60)\n at Generator.throw (<anonymous>)\n at rejected (/var/task/node_modules/amazon-qldb-driver-nodejs/dist/src/QldbDriver.js:18:65)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I started seeing this after I started adding this custom retry config. Here is how I'm including it, please let me know if I'm doing something wrong here:

const customRetryConfig = {
            retryLimit: 5, // Maximum number of retry attempts
            backoffFunction: (retryAttempt, error, transactionId) => {
                log.error(`Error: ${error} TransactionId: ${transactionId}`);
                return Math.pow(2, retryAttempt) * 100; // Starting at 100ms
            }
        };
        this.driver = new qldb.QldbDriver(
            'MyLedger',
            { region: 'us-east-1' },
            undefined,
            undefined,
            customRetryConfig
        );
normand1 commented 9 months ago

Found these release notes: https://github.com/awslabs/amazon-qldb-driver-nodejs/pull/44 Looks like I needed to import RetryConfig instead of passing as a POJO. Seems to be working now so closing this issue, thanks.