Aws-mobile-appsync-sdk-js: Better example for handling complex objects

Created on 22 Jan 2018  路  7Comments  路  Source: awslabs/aws-mobile-appsync-sdk-js

Hey

I am trying to understand how to use complex objects as described here.

Is there a better example to show how to write mapping templates for complex objects? For instance, let's say user profile info (picture, video etc) is stored in S3 bucket and I want to Query that info using GraphQL endpoint, how would I do that.

thanks
Sid

question

Most helpful comment

We have also released a sample application for this: https://github.com/aws-samples/aws-amplify-graphql

All 7 comments

I am also trying to find an example on how to upload complex objects to s3. To further complicate things, I am trying to use aws-amplify. Amplify has it's own Storage feature providing public/private uploads to an s3 bucket. Does aws-appsync plan to integrate with this feature?

Also is it possible to pass Amplify's essentialCredentials for accessKeyId and secretAccessKey in the AWSAppSyncClient config? This seems to fit the requirements for complexObjectsCredentials.
Reference: https://github.com/aws/aws-amplify/blob/master/packages/aws-amplify/src/Auth/Auth.ts

I think this is addressed by new documentation!

Thanks
Sid

We have also released a sample application for this: https://github.com/aws-samples/aws-amplify-graphql

looks great! thanks!

Is there an example for multiple files upload?

I can't seem to be able to get it working with multiple files.

thank you in advance

161

@sid88in Did you find how to upload to s3? I'm getting permission error in trying to upload to s3. Though I have literally allowed all settings in CORS and added AWS_IAM user. I wonder if the upload only works in appsync if the authentication is via AWS_IAM not if API or COGNITO_POOLS

cc: @undefobj

Do I have to strictly specify the "complexObjectsCredentials" in the AppSyncClient? I'm using an android client with cognito authentication and tried to upload a complex object to s3. The mutation works, but my bucket is still empty and no exceptions are thrown.

Any ideas?

Was this page helpful?
0 / 5 - 0 ratings