Steps to upgrade the AWS SDK from v2 to v3

0

My app is working fine with v2 of the AWS-SDK, but I see that when I run tests, there's a message stating that v2 is being moved to maintenance mode soon. I tried running aws-sdk-js-codemod per https://www.npmjs.com/package/aws-sdk-js-codemod, but I keep getting $ command not found when I run

$ npx aws-sdk-js-codemod@latest -t v2-to-v3 PATH...

I know I have npx installed because I ran $ npx create-react-app right before that.

What I want is a set of examples such as those found here:

https://www.npmjs.com/package/amazon-cognito-identity-js#usage.

If it's just a matter of converting the import I have

import AWS from "aws-sdk";

to that found in the docs, namely

import * as AWS from 'aws-sdk/global';

please advise.

Rob
질문됨 7달 전422회 조회
2개 답변
0

Hi,

When you run the command, try not to put the "$" symbol in the beginning, as it is generally used to indicate the command is being run in the terminal or command prompt.
The $ is not part of the command itself. It simply represents the command prompt and $ is not meant to be typed.

So, your command should be:

npx aws-sdk-js-codemod@latest -t v2-to-v3 example.ts

For more details regarding upgrading from v2 to v3, you can follow the guide: [1] [2].

References:
[1] https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/migrating-to-v3.html
[2] https://hackernoon.com/notes-on-migrating-aws-sdk-v2-to-v3-javascript-a-quick-guide-to-help-you-out

Thanks,
Atul

profile picture
답변함 7달 전
  • Hi Atul,

    Thanks for replying. I am aware that $ represents a bash prompt and it wasn't included in the command. I also substituted in the correct path for PATH. That said,

    npx aws-sdk-js-codemod@latest -t v2-to-v3 PATH...

    didn't work, stating command not found.

    For the record, I am not trying to use Lambdas, DynamoDB or S3. I am trying to use Cognito and I need instructions for how to perform all the operations detailed in https://www.npmjs.com/package/amazon-cognito-identity-js#usage. I had already read the docs you cite and didn't find them helpful.

0

Friendly ping.

Rob
답변함 6달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠