# Using aws-s3-multipart-copy into a function node

**URL:** <https://discourse.nodered.org/t/using-aws-s3-multipart-copy-into-a-function-node/86642>\
**Category:** General\
**Tags:** docker, function-node\
**Created:** [21 March 2024 16:37 UTC](https://discourse.nodered.org/t/using-aws-s3-multipart-copy-into-a-function-node/86642 "2024-03-21T16:37:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barbudor](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@Barbudor](https://discourse.nodered.org/u/Barbudor)\
**Post date:** [21 March 2024 16:37 UTC](https://discourse.nodered.org/t/using-aws-s3-multipart-copy-into-a-function-node/86642/1 "2024-03-21T16:37:09Z")

</div>

Hello

I'm trying to use this library in a function node: [aws-s3-multipart-copy - npm](https://www.npmjs.com/package/aws-s3-multipart-copy)

I have installed the requirements, AWS credentials are ok, and I'm using the below code in my function node which is based on the sample code:

```auto
let logger = bunyan.createLogger({
    name: 'copy-object-multipart',
    level: 'info',
    version: '1.0.0',
    logType: 'copy-object-multipart-log',
    serializers: { err: bunyan.stdSerializers.err }
});

let s3 = new AWS.S3();

s3Module.init(s3, logger);

let request_context = 'request_context';
let options = {
    source_bucket: 'mybucket',
    object_key: 'tmp/VID_20240320_175855.mp4',
    destination_bucket: 'mybucket',
    copied_object_name: 'tmp/test.mp4',
    object_size: 7388415,
    copy_part_size_bytes: 5000000,
    copied_object_permissions: 'bucket-owner-full-control',
    expiration_period: 100000,
    storage_class: 'STANDARD'
};

s3Module.copyObjectMultipart(options, request_context)
    .then((result) => {
        console.log(result);
        msg.payload = result
        return msg;
    })
    .catch((err) => {
        // handle error
    })

return null;

```

The good thing : it's working fine, the copy is performed.

However, I was expecting that on completion of the copy the code part in the `then` would be executed and the flow could go on with the message.

But it doesn't ☹

As my Javascript skills are quite basic, could someone point me in the right direction ?

As a secondary question, is it possible to redirect the logs in Node-RED's debug console as they currently goes to docker logs (node-RED running as a docker) and finely control what is output ? I don't need the info logs, only warning and errors.

thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 June 2024 16:37 UTC](https://discourse.nodered.org/t/using-aws-s3-multipart-copy-into-a-function-node/86642/2 "2024-06-19T16:37:35Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
