#✅ - AWS Amplify & AWS AppSync Conflict

1 messages · Page 1 of 1 (latest)

jaunty barn
#

Hey there ✌️ I am a very new dev so go easy on me.

I am trying to use Amplify and AppSync in my xcode project. But I cannot install both packages without having conflicts. The SPM returns the error "multiple products with name "AWSS3"". There are more conflicts but that is an example.

I can regress to amplify 1.xx and there are no conflicts. But I don't like the idea of refactoring my code base to get an older package aha.

Has anyone had any experience with this? I have done lot's of digging on forums and and done all of the trouble shooting that I can think of, even gpt-4 cannot help me this time aha.

Thanks in advance!

red cypress
#

Hey @jaunty barn 👋
You're trying to add Amplify Swift version 2.x and the AWS Mobile AppSync SDK in your target? (this one: https://github.com/awslabs/aws-mobile-appsync-sdk-ios)
If so, that's not a supported configuration; they're not intended to be used together. Can you elaborate on your use case and why you want to use both?

jaunty barn
#

@red cypress thanks so much for your answer! Yes I am trying to user them together. I am trying to use amplify 2.x for sign up and login, and I am trying to use AppSync for my graphql data base.

I am consfused, because when running codegen in Amplify it produces API.swift which has "import AWSAppSync".

So why would Amplify codegen produce a file with a dependancy that it cannot support? The version of SDK Amplify that I am using is the latest from "github.com/aws-amplify/amplify-swift.git". The SDK for AppSync is "https://github.com/awslabs/aws-mobile-appsync-sdk-ios.git". And the Amplify CLI version that I am using is "12.0.3".

Looking forward to your reply!

red cypress
#

I understand the confusion.

Let's start with what you should do, and then I'll explain the "why" after.
The recommended approach for using a GraphQL based API is using Amplify API (GraphQL). To do so, you generate the models using amplify codegen models . This generates Swift model files in your project under the AmplifyModels directory. When you do an amplify push, you'll answer no to the question Do you want to generate code for your newly created GraphQL API?. If you've already answered Yes to this in your existing project, you should delete the API.Swift file it generated and, if necessary, remove your project's dependency on the AWS AppSync SDK.

Now, the "why."
As I mentioned above, I understand the confusion. We'd like to make this clearer. Amplify CLI also supports generating an API.swift file for directly using the AWS AppSync SDK (without Amplify).
If you want to use AWS AppSync SDK by itself, you'd answer Yes to the question Do you want to generate code for your newly created GraphQL API?.
If you want to use Amplify, including the API (GraphQL) category, you'd run amplify codegen models and answer No to the question Do you want to generate code for your newly created GraphQL API? that comes when running amplify push.

I hope that helps. Please let me know if you have any other questions. Thanks!

icy nexusBOT
#

✅ - AWS Amplify & AWS AppSync Conflict