aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.09k stars 576 forks source link

Migration guide #1989

Closed daveisfera closed 2 years ago

daveisfera commented 3 years ago

Describe the issue with documentation

It would be very helpful to have Information on how to migrate from V2 module to this new V3 module. For example, simple uses like downloading or uploading a file from S3. With the V2 module, is was a simple call (like upload()), but appears to now be far more involved, so having examples on how to do this and a migration guide with example of V2 code and the corresponding V3 could would help users adopt this new module.

brmur commented 3 years ago

@daveisfera Thanks for you feedback. Have you seen these resources:

daveisfera commented 3 years ago

The examples are probably what I'm looking for (even though it seems that use of the V3 module is a LOT more complex than the V2 one), but I'm not seeing what the migration guide is showing. Basically, I don't see examples of using the old V2 module to do actions like download or upload a file and then the corresponding code for the V3 module.

mattvb91 commented 3 years ago

Have to agree with @daveisfera was looking to use v3 for the smaller lib size but it looks like its nowhere near as easy to quickly hook in as v2 if your planning on upgrading an existing project.

brmur commented 3 years ago

@daveisfera The welcome.html page in the dev guide for V3 goes through the basics differences between writing basic functions for V2 and V3.

daveisfera commented 3 years ago

Yes, but the code in the Comparing code size section is a perfect example. How is someone supposed to know that the old call to ddb.listTables needs to be replaced by a call to dbclient.send(new ListTablesCommand) and then calling results.Tables.forEach on that result? Basically, the V3 API appears to be quite a bit more complex and there doesn't appear to be a magic decoder ring anywhere to figure out how to use it.

brmur commented 3 years ago

@daveisfera Yes, there are some some significant changes in V3, and to reflect best practices the examples for V3 use the async/await pattern and the client.command(parameters) syntax. But you can still take advantage of V3 modularity and use V2 coding style such as

function run(){
         s3.createBucket(bucketParams, function(err, data) {
         if (err) {
         console.log("Error", err);
         } else {
         console.log("Success", data.Location);
         }
    })

See the Using V2 commands V3 Dev. Guide Welcome page.

daveisfera commented 3 years ago

That sounds great, but s3.upload() fails because it's not a defined function, so how do users know what's valid for a "V2 coding style" and what's not?

github-actions[bot] commented 2 years ago

Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.