Giter VIP home page Giter VIP logo

Comments (7)

seanadkinson avatar seanadkinson commented on July 17, 2024

For router.get('/test', ...), there would be no req.params[0], but I guess you aren't even using the params variable above.

In this example you posted, you are just doing an s3.listBuckets, so if that doesn't work, I'm not sure what the issue could be. Not sure this has anything to do with react-s3-uploader if you can't list buckets with this code.

It could be that you need to specify the region, but you may want to create an issue with aws-sdk.

from react-s3-uploader.

tdavis1198 avatar tdavis1198 commented on July 17, 2024

I think i figured out the problem. Looks like there is an undocumented option getFileKeyDir that needs to be set as follows

app.use('/s3', require('react-s3-uploader/s3router')({
    getFileKeyDir: function(req) {return("folder")},
    bucket: "bucket"
}));

If getFileKeyDir is not set it defaults to a function that returns "."

This results in the Key param that is used in the getSignedUrl calls being set to "./"

The getSignedUrl call will then sign the url using that Key. However, the actual url that is used to GET the image will not have the "./" characters.So the URL's do not match, hence the signature matching error.

So, create at least one directory in the bucket, and have it as the return value in the getFileKeyDir function.

from react-s3-uploader.

seanadkinson avatar seanadkinson commented on July 17, 2024

Ah, good catch. We should document that feature, but also return "" if not implemented. Thanks for the research.

from react-s3-uploader.

seanadkinson avatar seanadkinson commented on July 17, 2024

Just put up a fix on branch fix-getFilKeyDir. Can you try it out in your application and see if it works as expected?

Add this to your package.json to test the branch:

...
"react-s3-uploader": "odysseyscience/react-s3-uploader#fix-getFilKeyDir",
...

Delete node_modules/react-s3-uploader first, then run npm install

If all looks good, I'll push an update to NPM.

from react-s3-uploader.

tdavis1198 avatar tdavis1198 commented on July 17, 2024

Works for me. Thanks

On Apr 30, 2015, at 3:21 PM, seanadkinson [email protected] wrote:

Just put up a fix on branch fix-getFilKeyDir. Can you try it out in your application and see if it works as expected?

Add this to your package.json to test the branch:

...
"react-s3-uploader": "odysseyscience/react-s3-uploader#fix-getFilKeyDir",
...
Delete node_modules/react-s3-uploader first, then run npm install

If all looks good, I'll push an update to NPM.


Reply to this email directly or view it on GitHub #9 (comment).

from react-s3-uploader.

seanadkinson avatar seanadkinson commented on July 17, 2024

Pushed version 1.1.8. Thanks

from react-s3-uploader.

rankun203 avatar rankun203 commented on July 17, 2024

For those of you may encountered this problem, make sure your stringToSign responsed by aws is the same to the API calculated.

Search for stringToSign and put breakpoint there to debug.

from react-s3-uploader.

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.