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

Hello

I'm trying to use this library in a function node: aws-s3-multipart-copy - npm

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:

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 :frowning:

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

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