{"action":"created","issue":{"url":"https://api.github.com/repos/odysseyscience/react-s3-uploader/issues/9","labels_url":"https://api.github.com/repos/odysseyscience/react-s3-uploader/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/odysseyscience/react-s3-uploader/issues/9/comments","events_url":"https://api.github.com/repos/odysseyscience/react-s3-uploader/issues/9/events","html_url":"https://github.com/odysseyscience/react-s3-uploader/issues/9","id":72225229,"number":9,"title":"SignatureDoesNotMatch Error","user":{"login":"tdavis1198","id":48018,"avatar_url":"https://avatars.githubusercontent.com/u/48018?v=3","gravatar_id":"","url":"https://api.github.com/users/tdavis1198","html_url":"https://github.com/tdavis1198","followers_url":"https://api.github.com/users/tdavis1198/followers","following_url":"https://api.github.com/users/tdavis1198/following{/other_user}","gists_url":"https://api.github.com/users/tdavis1198/gists{/gist_id}","starred_url":"https://api.github.com/users/tdavis1198/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdavis1198/subscriptions","organizations_url":"https://api.github.com/users/tdavis1198/orgs","repos_url":"https://api.github.com/users/tdavis1198/repos","events_url":"https://api.github.com/users/tdavis1198/events{/privacy}","received_events_url":"https://api.github.com/users/tdavis1198/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-30T17:20:56Z","updated_at":"2015-04-30T19:10:08Z","closed_at":null,"body":"Using the latest version, created a simple test based on the readme.\r\n\r\nI have valid credentials and tested them using the following express route:\r\n\r\n    router.get('/test', function(req, res) {\r\n        var params = {\r\n            Bucket: S3_BUCKET,\r\n            Key: getFileKeyDir(req) + '/' + req.params[0]\r\n        };\r\n        var s3 = new aws.S3();\r\n        s3.listBuckets(function(error, data) {\r\n            if (error) {\r\n                console.log(error); // error is Response.error\r\n            } else {\r\n                console.log(data); // data is Response.data\r\n                res.json(data);\r\n            }\r\n        });        \r\n    });\r\n\r\nHowever, calls to .../get/img/t.png\r\n\r\nreturns the signature error.\r\n\r\nI have manually uploaded a file to the bucket and can view it using other 3rd party tools using the same credentials.\r\n\r\nAny ideas?\r\n\r\nBtw, i get the same error uploading.\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/odysseyscience/react-s3-uploader/issues/comments/97930922","html_url":"https://github.com/odysseyscience/react-s3-uploader/issues/9#issuecomment-97930922","issue_url":"https://api.github.com/repos/odysseyscience/react-s3-uploader/issues/9","id":97930922,"user":{"login":"tdavis1198","id":48018,"avatar_url":"https://avatars.githubusercontent.com/u/48018?v=3","gravatar_id":"","url":"https://api.github.com/users/tdavis1198","html_url":"https://github.com/tdavis1198","followers_url":"https://api.github.com/users/tdavis1198/followers","following_url":"https://api.github.com/users/tdavis1198/following{/other_user}","gists_url":"https://api.github.com/users/tdavis1198/gists{/gist_id}","starred_url":"https://api.github.com/users/tdavis1198/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdavis1198/subscriptions","organizations_url":"https://api.github.com/users/tdavis1198/orgs","repos_url":"https://api.github.com/users/tdavis1198/repos","events_url":"https://api.github.com/users/tdavis1198/events{/privacy}","received_events_url":"https://api.github.com/users/tdavis1198/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T19:10:08Z","updated_at":"2015-04-30T19:10:08Z","body":"I think i figured out the problem. Looks like there is an undocumented option getFileKeyDir that needs to be set as follows\r\n\r\n    app.use('/s3', require('react-s3-uploader/s3router')({\r\n    \tgetFileKeyDir: function(req) {return(\"folder\")},\r\n        bucket: \"bucket\"\r\n    }));\r\n\r\nIf getFileKeyDir is not set it defaults to a function that returns \".\"\r\n\r\nThis results in the Key param that is used in the getSignedUrl calls being set to \"./<filename>\"\r\n\r\nThe 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.\r\n\r\nSo, create at least one directory in the bucket, and have it as the return value in the getFileKeyDir function.\r\n\r\n\r\n\r\n"}}