aws-mobile-appsync-sdk-ios icon indicating copy to clipboard operation
aws-mobile-appsync-sdk-ios copied to clipboard

Feature Request: uploading multiple S3 object within a mutation

Open Derek-X-Wang opened this issue 6 years ago • 12 comments

Hi AppSync team,

It's a common use case that we would need to upload original media file along with thumbnail file.

Really hope we have this feature supported!

Thanks

Derek-X-Wang avatar Mar 12 '18 16:03 Derek-X-Wang

Hello @Derek-X-Wang

Thanks for reporting this use-case. I will take this as a feature request to the team.

In the mean while, could you use some lambda trigger to create thumbnails once the customer uploads the complex objects? You can find the tutorial to do that here.

Thanks, Rohan

rohandubal avatar Mar 12 '18 23:03 rohandubal

Hi @rohandubal,

Thanks for replying!

I had thought about that option in the beginning.

Since it's a mutation that will be used a lot, I would like to keep thumbnail generation locally to save some money.

I'm currently doing two mutations in sequence for uploading and it works.

But the thing just gets messier after we figure it out that we may need three complex objects.

It will be really awesome that the SDK will handle the S3 uploads.

Anyway, keep me updated on this.

Thanks, Derek

Derek-X-Wang avatar Mar 14 '18 06:03 Derek-X-Wang

Thanks again for explaining your use-case. This helps us determine our future features. I will keep this thread updated if we have a solution to achieve this in a simple way using the SDK.

Thanks, Rohan

rohandubal avatar Mar 14 '18 18:03 rohandubal

I came here because I just tried to do this, too! Specifically the thumbnail thing. I'll try the lambda solution for now and will watch this thread.

Thanks, guys!

end3r117 avatar Mar 31 '18 07:03 end3r117

I can get this worked with my folk: https://github.com/luannguyenkhoa/aws-mobile-appsync-sdk-ios The only thing you need to implement is adding a func inside extension AWSS3TransferUtility: AWSS3ObjectManager{} in API.swift file as below:

public func uploadFiles(s3Objects: [AWSS3InputObjectProtocol & AWSS3ObjectProtocol], completion: @escaping ((Bool, Error?) -> Void)) {}

that should performs a parallel file upload when getting invoked. All changes are included the latest commit, very appreciated if you guys can take a look and leave some ideas.

luannguyenkhoa avatar Aug 21 '18 08:08 luannguyenkhoa

@palpatim, @rohandubal - Is there any movement on this feature implementation? We'd also like the option to upload multiple S3 object types within a single mutation.

adamup928 avatar Jun 11 '19 18:06 adamup928

Hello all, Do we have any update on this issue? I'm using AWSAppSync 3.0.0 but seems no way to upload more than one s3 object in the same mutation.

input CreateMessageInput {
	id: ID
	messageContent: [S3ObjectInput] -> Unable to upload
}
input CreateMessageInput {
	id: ID
	messageContent: S3ObjectInput -> Work fine
}

@luannguyenkhoa did you able to handle this issue? Thanks

DanteEvil avatar Apr 09 '20 13:04 DanteEvil

Hi,

I'm also curious about the status of this. I'm planning to write a schema with a model that will have an array of photos and am hoping to use the built in s3 support

thanks!

julien-tamade avatar May 03 '20 07:05 julien-tamade

They've said they're aware of the feature request. As others have pointed out, it really just comes down to adding a method or two to the existing code. A while back, I also made a fork that worked for my purposes. [UPDATE] I updated the code for AWSAppSync 3.1.3. Still works for me.

Fork's diff page showing methods

It just recursively parses out the multiple S3Objects from their GraphQLMapConvertible structs... Again, works for me . Maybe it'll at least help point you in the right direction until official SDK support.

end3r117 avatar May 03 '20 18:05 end3r117

Hi,

Just wanted to see if there is an update/timeline on this issue? We are also planning on using a schema with multiple s3 objects and it would be awesome to have SDK support for this.

Thanks!

jonathanarevalogaray avatar Aug 27 '20 16:08 jonathanarevalogaray

Hi,

It has been over 3 years, what is the status on this? Are there any recommendations/other approaches?

Thanks.

jonathanarevalogaray avatar Jul 09 '21 17:07 jonathanarevalogaray

@jonathanarevalogaray I ended up using RxSwift to handle this issue, basically, I've used zip to merge multiple uploading requests then subscript for the result when all of them are finished.

DanteEvil avatar Jul 10 '21 06:07 DanteEvil

Thank you for opening this issue. AWS AppSync SDK for iOS entered maintenance mode in September 2023 and will receive no further updates as of September 2024.

Please use Amplify Swift going forward. For information on upgrading to Amplify Swift, refer to the Upgrade from AppSync SDK documentation.

atierian avatar Dec 07 '23 20:12 atierian