-
Notifications
You must be signed in to change notification settings - Fork 2k
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 lambda to upload file #1739
Conversation
@charleswong28: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
Encountered a problem with uploading image in my project.
Changing |
So close! In need of this fix! :D Please |
@charleswong28 have been using this in development for the past week and havent had any issues so far FWIW |
Any movement on reviewing this PR? my work progress is blocked by the issues this fixes |
Can someone advise if I can take over this PR? As far as I am aware it has passed all test and simply requires to be rebased with master - is this correct? Im obviously not want to take any credit from @charleswong28 - I just simply need this fix ASAP |
eeccd2f
to
d60a288
Compare
I am not sure uploadsConfig and unit test are the best way to do it. Hope there are some suggestions from the team. Anyway, I've squashed and rebased to master. My production branch also needs this fix ASAP. It's quite troublesome to use forked local branch currently when deploying this on lambda. |
@charleswong28 it is troublesome. MY work around was the following:
|
Any updates on this PR being merged? |
Any updates? |
Any updates on this? Like everyone else here I have a few projects that could benefit a lot from this. |
Like everyone else, any updates on this PR being merged? |
Thanks for opening this PR! It looks like this has adopted many of the practices Apollo uses on non-"handler" based implementations (that is to say, those that instead use I think the first step now will be rebasing this current When that is done, I think we can get this into a release. |
Add support for lambda to upload file
That would be very helpful. Sorry that I still couldn't squeeze time out for this yet. Another way would be cloning it next to your example repository and use |
Create a demo with your PR Code: |
It shows internal server error due to service timeout and "src" is missing in your postman.json. I've created a PR in your repository. In my branch, I am able to see the
in uploadFiles resolver files param. Hope this could help! |
Any updates on when this PR could be merged to master? |
Hey guys, Anyone from the team following this PR ? |
Is this PR going to get merged or has it fallen stale? |
"requires": true, | ||
"dependencies": { | ||
"@apollographql/apollo-upload-server": { | ||
"version": "5.0.3", |
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.
this was replaced with https://github.com/jaydenseric/graphql-upload I suppose
I'm all down for using graphql-upload for now, but don't you think it would be better to merge this into master for sake of continuity between implementations? |
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've rebased this off the recent master
and taken care of the merge conflicts to bring it up to date, but I need to ask that this code be re-structured into a more natural and intuitive work-flow.
I've left some notes below, but as an example, kicking off the chain with a function which returns a Promise
called fileUploadProcess
(not to be confused with the existing processFileUploads
!) doesn't seem like the right ordering of concern. File uploads are an optional feature, so this is counter intuitive for someone reading the code.
Also, the critical promiseWillStart
is now buried inside a then
-able, rather than being the very first thing that happens (which it should be).
I'm pretty sure the implementation you've offered here would work as is, but in terms of maintainability, we need to consider another approach. I'll help how I can, but I hope you can understand my hesitation here.
// to `await` the `promiseWillStart` which we kicked off at the top of | ||
// this method to ensure that it runs to completion (which is part of | ||
// its contract) prior to processing the request. | ||
await promiseWillStart; |
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.
The promiseWillStart
must be awaited prior to entering the fileUploadProcess
. We can't wait until after processing the file upload to fire this callback.
})(event, context, callbackFilter); | ||
const response = new Stream.Writable(); | ||
|
||
fileUploadProcess(event, response, this.uploadsConfig || {}) |
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.
The code here would seem to work, but this is a confusing arrangement of logic. The fileUploadProcess
shouldn't be the thing that kicks off the chain, it should be an optional chain within the path of request handling.
To put it another way, let's maintain that graphqlLambda
is the thing that gets kicked off, and the callback passed to graphqlLambda
be the part of the code that brings the upload processing, rather than having
graphqlLambdatriggered within
fileUploadProcess` — that's not an intuitive place for it.
}; | ||
} | ||
} | ||
|
||
const fileUploadProcess = ( |
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.
This name is too close to processFileUploads
. This might be better named as a processRequest
, but that's not even quite right. I realize that this code left some to be desired before, but I'm afraid that this makes it quite difficult to understand. There are several other frameworks to use as a basis, but this is pretty far from all of them right now.
Any updates for this PR? |
I would love to see this get finished off, it's so close yet such slow progress.. I have had a real headache getting this working:
Hopefully this will help someone if they are desperate enough to use it now. |
Turned out that I was handling base64 encoded files elsewhere in my code. I can confirm that it is now working by applying steps 3 and 4 from #1739 (comment) |
Any updates on this PR? |
What's left on this preventing a merge? I need to add a feature to handle file uploads in my project very soon and I'd like to do it the officially supported way so it doesn't have to be changed later. Are there specific action items that need to be addressed before this gets merged? |
@charleswong28 I see the last commit was on Feb 14th 2019 : are you still planning to work on this PR? is it ok if I open a new PR with commits to address the requested changes by @abernix? |
Would love to take over this PR if @charleswong28 is not planning on fixing it further. |
@jurienhamaker @aymericbouzy Sorry for not having enough time to work on this. It would be great if you guys could help. |
@charleswong28 no worries, we totally understand 😄 |
I've created a new PR #3676 that uses some of @charleswong28's work from this PR and attempts to incorporate the comments by @abernix on this PR. All checks have passed, so hoping to get it merged pretty quickly as we actually need to use it :) Feel free to chime in over there. |
Aim to provide file-upload parity support — as already supported within the other Apollo Server integration packages — via the third-party `graphql-upload` package. Co-authored-by: charleswong28 <[email protected]> Co-authored-by: Steve Babigian <[email protected]> Co-authored-by: Jesse Rosenberger <[email protected]> Closes: #1419 Closes: #1703 Supersedes: #1739 ...and therefore... Closes: #1739 Supersedes: #3676 ...and therefore... Closes: #3676
Superseded by #3926, which has merged into |
Fix #1419, #1703 file upload using lambda.
TODO:
Graphql and apollo-server are still quite new to me. It would be great if anyone here could point me to the right direction.