aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.43k stars 2.13k forks source link

How to update aws-sdk dependency from 2.474.0 to 2.518.0? #3923

Closed matwerber1 closed 5 years ago

matwerber1 commented 5 years ago

Which Category is your question related to? Amplify, Aurora Serverless

What AWS Services are you utilizing? Amplify, Aurora Serverless

Provide additional details e.g. code snippets

When attempting this:

var AWS = require('aws-sdk');
var rdsdataservice = new AWS.RDSDataService({apiVersion: '2018-08-01'});

I receive this error: TypeError: AWS.RDSDataService is not a constructor

a console.log(AWS.VERSION) shows 2.474.0, which does not contain the RDSDataService; I'm trying to force a dependency update to 2.518.0.

In my project root, I navigate to ./node-modules/@aws-amplify/core/package.json and update dependencies to:

"dependencies": {
    "aws-sdk": "2.518.0",
    "url": "^0.11.0"
  },

Then I run npm install in that directory. I then navigate to the project root, delete the root ./package.json, and run npm shrinkwrap, which creates npm-shrinkwrap.json and verify it contains:

"@aws-amplify/core": {
      "version": "1.1.0",
     ....
      },
      "dependencies": {
        "aws-sdk": {
          "version": "2.518.0",

My understanding is that this should work, but my project continues to show 2.474.0 from console.log(AWS.VERSION).

Can you advise on how I can force a newer aws-sdk version? Understood that I could use GraphQL/AppSync to interact with Aurora Serverless but for the project I'm working on I'd like to make the API call directly from the browser using Cognito federated identities.

matwerber1 commented 5 years ago

So, with the assistance of @wizage, found that aws-amplify (v 1.1.36) installed in a clean project (e.g. npm init, npm install aws-amplify) using aws-sdk 2.474.0 worked fine. It was only in an environment from npm create react-app test + amplify init where the issue arises.

On top of that, changing var rdsdataservice = new AWS.RDSDataService({apiVersion: '2018-08-01'}); to var rdsdataservice = require('aws-sdk/clients/rdsdataservice'); gets the Amplify project working.

I was mistaken in thinking that the aws-sdk dependency needed to be updated to 2.474.0. In any case, still not sure why the fix above was needed, but ok to close this issue unless you want to further investigate.

sammartinez commented 5 years ago

@matwerber1 Sounds good, I will close this then. Glad you got it solved!

jkeys-ecg-nmsu commented 4 years ago

@sammartinez is there a simple way of forcing a newer version of the SDK?

sammartinez commented 4 years ago

@jkeys-ecg-nmsu are you looking for an SDK version higher than 2.518.0? We do pin it based on breaking changes that can cause issues to Amplify. But Im going to cut an issue to see about updating the aws-sdk version in our core package.

jkeys-ecg-nmsu commented 4 years ago

@sammartinez yes, we would like to use the Kinesis Video Streams WebRTC integration, which requires at least 2.585.0.

Thank you for tagging the request.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.