question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use multiple S3 buckets

See original GitHub issue

Hello, I’m trying to connect a second S3 bucket to my Node.js companion server.

After looking at the configuration, I did not find any option to specify more than one bucket for the same instance, so I thought about adding a second instance on another route.

So far so good, but as soon as I start the server, I get this error:

TypeError: Cannot add property 1, object is not extensible
    at Array.push (<anonymous>)
    at ..\node_modules\@uppy\companion\lib\server\logger.js:14:22
    at Array.forEach (<anonymous>)
    at Object.exports.setMaskables (..\node_modules\@uppy\companion\lib\server\logger.js:13:15)
    at maskLogger (..\node_modules\@uppy\companion\lib\companion.js:181:12)
    at Object.module.exports.app (..\node_modules\@uppy\companion\lib\companion.js:61:5)
    at createUppyCompanion (..\src\routes\uppy\createUppyEndpoint.ts:43:20)
    at Object.createUppyEndpoint (..\src\routes\uppy\createUppyEndpoint.ts:16:14)
    at Object.<anonymous> (..\src\routes\uppy\uppyArchiveRoute.ts:4:33)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)

I can temporary fix this error by commenting out this line:

exports.setMaskables = (maskables) => {
    maskables.forEach((i) => {
        valuesToMask.push(escapeStringRegexp(i));
    });
    //Object.freeze(valuesToMask);
};

Now, my question is, if this is a bug or how to support multiple buckets otherwise?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mificommented, Dec 6, 2021

I think just removing object.freeze is not the right way to do it, because then two app instances created with different configs will compete to overwrite this singleton variable, as well as cause issues with the other singletons/globals that are created. I think it boils down to whether we want to do the effort of rewriting all the singleton global state and instead place it inside the companion instance / closure.

if not ,then I think we should throw a better error message if someone tries to initialize the companion app twice.

1reaction
baba43commented, Oct 6, 2021

Cool. Out of curiosity, may you share what is your use case for uploading to multiple s3 buckets?

Well, our system includes several functions, some of which operate with different buckets for the purpose of organization, permissions, etc.

For me, the use of multiple buckets was nothing special. There are several reasons why a server needs to support multiple buckets or even multiple AWS accounts.

So I think it would at least make sense if we could use multiple Uppy instances in the long run, even if they might not run optimized then. If my workaround hadn’t worked, my only option would have been to set up a second server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it better to have multiple s3 buckets or one bucket with sub ...
If the images are used in different use cases, using multiple buckets will simplify the permissions model, since you can give clients/users ...
Read more >
How to serve multiple S3 buckets via single AWS CloudFront ...
In this blog, I will take you step by step on how you can serve content from multiple S3 buckets using a single...
Read more >
What is the best, one bucket or multiple bucket? #15 - GitHub
One benefit of the multiple S3 buckets configuration is the ability to have a different configuration (policies) for each bucket, that in turn ......
Read more >
How to serve multiple S3 buckets via AWS CloudFront
cloudyvim #s3 #cloudfrontIn this video, we'll go step-by-step on how you can serve content from multiple S3 buckets using a single AWS ...
Read more >
Is it better to have multiple s3 buckets or one bucket ... - Reddit
Agreed. multiple buckets means different security groups which is better for security. it also allows for more granular management (you can take ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found