Aurora serverless, RDSDataService, executeStatement() API, " Unexpected key 'formatRecordsAs' found in params" error

1

Hello, I'm trying to add formatRecordsAs parameter to sqlParams for Aurora serverless RDSDataService (according to RDSDataService SDK) and getting "Unexpected key 'formatRecordsAs' found in params". Here is my code sample:

let sqlParams = {
        secretArn: storeArn.Value,
        resourceArn: dbArn.Value,
        database: dbSchema.Value,
        formatRecordsAs: 'JSON'
      };
sqlParams.sql = `select ...`;
let data = await RDS.executeStatement(sqlParams).promise();

Note that without "formatRecordsAs" parameter all works just fine. I double checked with RDSDataService SDK docs and didn't find any inconsistency in my code. What I might possibly missing here???

Thank you,

Victor.

Victor
asked 2 years ago261 views
1 Answer
0

Hi, if you are using a lambda function, then the sdk version in use is 2.1055 at the time of this answer (https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html), and in this version 'formatRecordAs' parameter isn't supported.

As a workaround, you should create a lambda layer with a more recent sdk version (v3 is already available).

Hope this helps :)

Alexis
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions