Giter Club home page Giter Club logo

Comments (8)

amark avatar amark commented on May 16, 2024

What are the names of the ENV variables? They have to be specific. Could you also maybe try passing the S3 opt with the explicitly referencing process.env? See https://github.com/alexlafroscia/stickies/blob/master/server/app.js as an example.

Also, if you don't already know this... S3 can be fickle, you have to create the bucket before hand and you have to create an Access Control Policy for your token that allows it read/write to that bucket.

If you're not familiar with S3 let me know and I'll send you a sample.

from gun.

speier avatar speier commented on May 16, 2024

Using S3 regularly, so my env keys are fine. It turns out, I have to specify the region though.

$ aws s3 cp test.txt s3://foo-bar/test.txt

upload failed: [...] You are attempting to operate on a bucket in a region that requires Signature Version 4. You can fix this issue by explicitly providing the correct region location [...]

So I've specified the region and it wokrs like charm.

var gun = Gun({
    s3: {
        bucket: 'foo-bar', // my aws keys are set in env variables
        region: 'eu-central-1'
    }
});

Btw, thanks for the quick response.

ps: it would be nice if the S3 plugin could provide error details, if possible..

from gun.

amark avatar amark commented on May 16, 2024

Errors propagate back up through the plugins, for instance if:

gun.set({foo: 'bar'}, function(err){
  if(err){ console.log(err) }
});

Fails at the S3 level, you'll get that error back in that callback.

from gun.

speier avatar speier commented on May 16, 2024

There is no callback in this case. Gun keeps trying to create the key..
https://github.com/amark/gun/blob/master/lib/s3.js#L76

from gun.

amark avatar amark commented on May 16, 2024

ooooh, yeah. That counts as a bug, because it should auto-retry up to an exponential retry limit where it finally does halt, and report the error. This needs to be fixed. Know any easy/simple inline exponential retry tricks?

from gun.

speier avatar speier commented on May 16, 2024

Here is a really simple exponential backoff algorithm: http://blog.johnryding.com/post/78544969349/how-to-reconnect-web-sockets-in-a-realtime-web-app

OR here is a more sopisthicated package: https://github.com/unshiftio/recovery

from gun.

speier avatar speier commented on May 16, 2024

I was interested implementing this, so came up with a simple solution, please find here: speier/bakeoff

from gun.

amark avatar amark commented on May 16, 2024

Thanks, the johnryding article is actually really nice and helpful. Nice bakeoff library, just starred it.

While, yes, this thread should be closed, a bug still remains on the infinite loop of S3 retries. Not very high on my priority list, but it is still on my mind.

You should chat with me in the https://gitter.im/amark/gun!

from gun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.