Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] TypeError: config.RDS.executeStatement is not a function #3

Closed
harleyguru opened this issue Jun 10, 2019 · 7 comments
Closed

Comments

@harleyguru
Copy link

harleyguru commented Jun 10, 2019

Hello,

I am getting this error when I run below code:

const data = require('data-api-client')({
  secretArn: process.env.AWS_SECRET_STORE_ARN,
  resourceArn: process.env.DB_CLUSTER_ARN,
  database: process.env.DB_NAME
});

describe('postConfirmation tests', () => {
  test('usp_get_invitation', async () => {
    expect.assertions(1);
    const email = 'ravi@test.com';
    try {
      let invitations = await data.query(`call usp_get_invitation(:email)`, { email });
      console.log(JSON.stringify(invitations));

      expect(invitations).toEqual(expect.anything());
    } catch (error) {
      console.error(error);
    }
  });
});
TypeError: config.RDS.executeStatement is not a function
          at query (/home/ubuntu/Recruiter-backend/node_modules/data-api-client/index.js:321:22)
          at Object.query (/home/ubuntu/Recruiter-backend/node_modules/data-api-client/index.js:471:22)
          at Object.test (/home/ubuntu/Recruiter-backend/__tests__/handlers/handler.test.js:22:36)
          at Object.asyncFn (/home/ubuntu/Recruiter-backend/node_modules/jest-jasmine2/build/jasmine_async.js:82:37)
          at resolve (/home/ubuntu/Recruiter-backend/node_modules/jest-jasmine2/build/queue_runner.js:52:12)
          at new Promise (<anonymous>)
          at mapper (/home/ubuntu/Recruiter-backend/node_modules/jest-jasmine2/build/queue_runner.js:39:19)
          at promise.then (/home/ubuntu/Recruiter-backend/node_modules/jest-jasmine2/build/queue_runner.js:73:82)
          at <anonymous>

Looking forward your help.

@jeremydaly
Copy link
Owner

Hmm, do you have the latest version of the AWS-SDK installed?

@jeremydaly
Copy link
Owner

I just tried this without error:

  const id = 1
  let result = await data.query('call get_cat(:id)', { id })

@harleyguru
Copy link
Author

hmm
"aws-sdk": "^2.441.0",
This is my AWS SDK version.

@matuella
Copy link

Latest is 2.471.0 - you can see it here. I guess you need to use the version superior to 2.466.0 which states:

The new APIs included in this SDK release are ExecuteStatement, BatchExecuteStatement, BeginTransaction, CommitTransaction, and RollbackTransaction. The ExecuteSql API is deprecated; instead use ExecuteStatement which provides additional functionality including transaction support.

@harleyguru
Copy link
Author

Ahh, Thanks for your finding the issue @matuella and @jeremydaly .
Now I make sense why it didn't work and understand fully.
Thanks a lot. I expect this library will be very useful for a lot of developers in the future and getting perfect more and more.

Just one concern is this should be updated according to the response format and updates of RDS Data API in the future.

@harleyguru
Copy link
Author

Once it works, I will close the issue after the confirmation!

@harleyguru
Copy link
Author

That was the reason of this issue. I close now.
Thanks for your pointing the issue right soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants