-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for saving files to AWS S3 #113
Conversation
// For a given config object, filename, and data, store a file in S3 | ||
// Returns a promise containing the S3 object creation response | ||
S3Adapter.prototype.create = function(config, filename, data) { | ||
var self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious if this is the best/most idiomatic way of doing this. I couldn't reference this
object within the Promise function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the AWS node library can load
it's config from a JS object. I'm debating whether the S3Adapter should just take such an object as parameter or something. That would potentially allow more configuration of the S3 object, although would probably make it less errr simple. Again, what's more idiomatic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to access this
, as ExportAdapter
uses it heavily...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok discussed offline, apparently ES6 arrow function (=>) is the way to go
👍 |
hmmm I clearly messed up something in that rebase. Let me try to fix this |
Ok, I fixed it. Should be good to merge when accepted. |
Add support for saving files to AWS S3
@skinp looking forward to your wiki/docs on your AWS implementation, can't seem to get it working.. |
@edvincandon the S3Adapter object is not exposed directly just yet. If you're trying to use my example from earlier, you need one more require line to get access to S3Adapter object:
Docs to come, and this object should be exposed in some next versions. |
@skinp This is great! Looking forward to a guide! |
Hey @skinp - Stil trying to figure out what's wrong, Server-side logs empty for this issue. I'm fairly new to S3 and the AWS SDK, but I saw they had their own error handling codes and messages - would it be possible to pass those to
Would be a nice implementation for debugging purposes, no? EDIT - Error was on my side with my bucket configuration. |
@edvincandon glad you got it figured out. Yeah I was printing that error when developing this module but the errors coming from the AWS SDK ended up being too verbose. Maybe we could print them to the server log instead. I'm going to first write docs for this. Let's see if having clear docs helps reduce the amount of errors/confusion people get with this Adapter and we'll see after if we need better errors/logging. |
@edvincandon I'm having the same error here |
@leobortolotti Next select S3 Bucket Policy as your desired type of policy Generate the policy and add it to your bucket! Hope it helps! Also make sure your bucket is CORS enabled, your CORS configuration should look something like this:
|
@edvincandon Thank you very much!!! |
Are you using the latest parse-server release? If not, try updating.. |
I did this but I'm still getting this error! But thanks again! |
Ohhhh, I got it!!! Seems like my Access Key and Secret Key was not working/inactive, I don't know why!! |
As far as I understand the code this does not support deleting the file via REST API, right? In my setup I'm deleting files using Parse Cloud:
which returns an |
@flavordaaave Delete will be implemented in #354 and will require the master key. |
@skinp updated the pull request. |
@gfosco still getting an
|
@skinp updated the pull request. |
Updating to use latest parse-server and parse sdk for Live Query launch
Using Mongo's GridStore for file storage is fine for basic usage, but it won't scale much. Heavy production users should use a proper file/object storage system. Let's at least officially add support for S3 storage for Parse files.
To use this:
Once this is accepted, I'll add docs to the wiki on how to use this properly and explain all the available options.