Skip to content
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

Question: AWS Amplify Graphql S3 Integration #799

Closed
obrian33 opened this issue Oct 3, 2020 · 9 comments
Closed

Question: AWS Amplify Graphql S3 Integration #799

obrian33 opened this issue Oct 3, 2020 · 9 comments
Labels
api Issues related to the API category feature-request Request a new feature

Comments

@obrian33
Copy link

obrian33 commented Oct 3, 2020

Reading through the documentation I see this line:

"The GraphQL Transform handles creating the relevant input types and will store pointers to S3 objects in Amazon DynamoDB. The AppSync SDKs and Amplify library handle uploading the files to S3 transparently."

From what I understand, this means by running a graphql request with the described S3Object definition I should be able to do a mutation and by running that mutation upload the data to S3. However, that doesn't happen. I'm curious to know if this functionality exists and how to do it or if I am misinterpreting what's being said, thanks!

https://docs.amplify.aws/cli/graphql-transformer/storage#basics

@royjit
Copy link
Contributor

royjit commented Oct 6, 2020

Hi @obrian33 Can you please provide the code snippet that you are trying. It would be great if you can provide the following details to help us debug the issue:


To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment(please complete the following information):

  • Amplify Framework Version: [e.g. 0.10.0]
  • Dependency Manager: [e.g. Cocoapods, Carthage]
  • Swift Version : [e.g. 5.0]

Device Information (please complete the following information):

  • Device: [e.g. iPhone6, Simulator]
  • iOS Version: [e.g. iOS 11]
  • Specific to simulators:

Additional context
Add any other context about the problem here.

@royjit royjit added api Issues related to the API category pending-community-response Issue is pending response from the issue requestor question General question labels Oct 6, 2020
@royjit
Copy link
Contributor

royjit commented Oct 6, 2020

In case of iOS uploading data to S3 is supported for iOS Appsync SDK, please find the documentation here under Working with complex objects.

But iOS Amplify API category doesnot support complex objects currently.

@obrian33
Copy link
Author

obrian33 commented Oct 6, 2020

Thanks for the response!

Here is the additional info requested:

To Reproduce:

Create a Amazon S3 bucket to hold files via amplify add storage.

Create a user pool in Amazon Cognito User Pools via amplify add auth.

Create a GraphQL API via amplify add api and add the following type definition:

type S3Object {
bucket: String!
region: String!
key: String!
}

type Picture @model @auth(rules: [{allow: owner}]) {
id: ID!
name: String
owner: String
file: S3Object
}

Run this mutation with S3 objects from your client app:

mutation ($input: CreatePictureInput!) {
createPicture(input: $input) {
id
name
visibility
owner
createdAt
file {
region
bucket
key
}
}
}

Expected Behavior:
Uploaded complex S3Object will appear in the specified bucket and region with inputted key.

Environment:

  • Amplify Framework Version: 1.1.1

  • Dependency Manager: Cocoapods

  • Swift Version : 5.0

Device Information:

  • Device: iPhone 11 Pro Simulator (13.3)

@obrian33
Copy link
Author

obrian33 commented Oct 6, 2020

@royjit Your latest comment seems to address my main concern because I am not using the AWS Mobile SDK but strictly the iOS Amplify API. My current workaround is to run a graphql mutation and then use the Amplify.Storage.uploadData function to upload and then the Amplify.Storage.downloadData function during queries to retrieve the complex objects from S3, is there any plans to include complex object support for Amplify.API?

@royjit
Copy link
Contributor

royjit commented Oct 9, 2020

Yes, you are right that would be the current approach. We will take this as a feature request and will update here when we have more info.

@royjit royjit added feature-request Request a new feature and removed pending-community-response Issue is pending response from the issue requestor labels Oct 9, 2020
@obrian33
Copy link
Author

Thanks! Excited to see what comes next :)

@drochetti drochetti added the pending-triage Issue is pending triage label Oct 13, 2020
@diegocstn diegocstn removed the question General question label Feb 17, 2021
@lawmicha
Copy link
Contributor

lawmicha commented Jun 7, 2021

related issue on the SDK / AppSync SDK aws-amplify/aws-sdk-ios#1740

@smkoop25
Copy link

smkoop25 commented Aug 8, 2021

@royjit Any updates on using complex objects with Amplify?

@lawmicha lawmicha removed the pending-triage Issue is pending triage label Apr 27, 2022
@lawmicha lawmicha added the p3 label Jun 8, 2022
@lawmicha
Copy link
Contributor

lawmicha commented Aug 10, 2023

We currently do not support performing both the S3 upload and mutation request through one API call, aka "complex objects" support in the SDK. Please see "working with files" documentation for more details. Draft in aws-amplify/docs#5649

Please track #537 for Complex Object support

@lawmicha lawmicha changed the title Question: AWS Amplify Graphql S3 Integration [Feature Request] AWS Amplify Graphql S3 Integration (Complex Objects) Aug 10, 2023
@lawmicha lawmicha removed their assignment Aug 10, 2023
@lawmicha lawmicha changed the title [Feature Request] AWS Amplify Graphql S3 Integration (Complex Objects) Question: AWS Amplify Graphql S3 Integration Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to the API category feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

6 participants