scripting / Scripting-News

I'm starting to use GitHub for work on my blog. Why not? It's got good communication and collaboration tools. Why not hook it up to a blog?
121 stars 10 forks source link

Calling S3 from a command-line tool #253

Open scripting opened 1 year ago

scripting commented 1 year ago

I'm working on a command-line tool that connects to S3 among other things. But there's a problem. When the app opens, ie every time you issue a command, we get a multi-line message from the AWS package saying it's time to convert to the new version of their API.

Okay great. I guess now I finally have to convert. So I go to their website and like all Amazon docs, it never gets to the point.

I have all my S3 code in one package, so it should be easy for me to transition.

https://github.com/scripting/s3/blob/master/daves3.js

Anyway, please if you have any ideas, I have just this code to convert.

scripting commented 1 year ago

Maybe this might help..

https://www.npmjs.com/package/s3fs

Pavonis commented 1 year ago

Hey @scripting, the documentation for version 3 of the AWS S3 client lives here: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/.

Because it's AWS, it's not a drop-in replacement to move from v2 to v3, and I imagine you don't want to waste time supporting their new syntax, but there is documentation for using the v3 client in a fully v2 compatible mode: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/#v2-compatible-style

I've used the v3 version of the client extensively, and it's quite stable, but I've never used it in this compatibility mode described in the docs, so YMMV.

scotthansonde commented 1 year ago

@scripting Doing some searching I found a thread explaining where the message is coming from and how to suppress it...

require('aws-sdk/lib/maintenance_mode_message').suppress = true;

But of course that's just a band-aid and not a solution.

scripting commented 1 year ago

@scotthansonde -- that worked! hooooray.

@Pavonis -- thanks for the tip. i'm going to look into using that.

scripting commented 1 year ago

@scotthansonde -- and i baked it into daves3 package so now the stinky messages are suppressed in everything. i won't forget.