Closed martinrist closed 1 year ago
Initial investigation that we've done so far into the cause of the dependency resolution failure:
amplify-swift
2.6.0 depends on aws-sdk-swift
0.6.1, which includes a number of products / targets.
aws-mobile-appsync-sdk-ios
3.6.2 depends on aws-sdk-ios-spm
2.30.1 ... 2.31.0
. At time of writing, that's currently resolving to 2.30.4, which looks like it's programatically creating products and targets which looks like it's based on a map that overlaps with those exposed by amplify-swift
.
In my case, I was trying to upgrade version from 1.x
something, the same error came out when 2.6.0
version of sdk has installed.
And I realized that I have aws-sdk-ios-spm
package dependency too, when I removed the dependency it worked well
If I have amplify-swift
2.6.0 and aws-sdk-ios-spm
2.30.4 added as top-level package dependencies, then I'm seeing the same 'duplicate product' / 'duplicate target' failures as @msk-psp . This seems to confirm that's the root cause.
Unfortunately, in our case, aws-sdk-ios-spm
is a transitive dependency of aws-mobile-appsync-sdk-ios
, so we're not able to remove the aws-sdk-ios-spm
dependency without getting rid of all of the features of aws-mobile-appsync-sdk-ios
.
Our long-term plan is to migrate to using the AppSync features in Amplify v2.x. However, that's a big migration path, as the AppSync client-side API has changed significantly between aws-mobile-appsync-sdk-ios
and amplify-swift
2.6.0. We don't have time to do that migration as part of moving to Amplify v2.x (which is required for a different reason), so we're trying to explore whether it's possible to use a combination.
Unfortunately Amplify v2 is not compatible with aws-sdk-ios. The root cause being the underlying low level SDK are different in Amplify v2, it uses aws-sdk-swift instead of aws-sdk-ios. This cause naming conflict if you use the library along with aws-sdk-ios.
If you would like to use Amplify with aws-sdk-ios, one option is to use the v1 version of Amplify, which depend on the aws-mobile-appsync-sdk-ios.
@royjit - thanks for the confirmation. I was expecting that to be the result, but good to hear that we've not missed a subtle workaround to resolve the issue.
Unfortunately we have no choice but to use Amplify v2, as we need some of the features that aren't in v1. So we'll have to focus on the full migration.
I'm happy to mark this issue as closed, now that it's confirmed there's no resolution.
Wait so do just use exact version of 2.72.2? Kinda confused on how to make this work.
Describe the bug
We are currently migrating to v2.x of the
amplify-swift
library in order to use some new authentication features that are only available in Amplify 2.x.However, our current AppSync schema and model generation process requires us to use
aws-mobile-appsync-sdk-ios
, since the Amplify CLI'samplify codegen
command generates models that importAWSAppSync
and uses the Apollo GraphQL-style API (e.g.GraphQLMapConvertible
,GraphQLMap
etc).However, when I attempt to create a package dependency on
amplify-swift
v2.6.0 alongsideaws-mobile-appsync-sdk-ios
v.3.6.2, I get a large number of errors during package resolution. These are all of the form:and
There are a total of 33 such pairs of messages, with each of a number of AWS libraries appearing twice - once with each message.
Steps To Reproduce
Expected behavior
Both versions of the libraries should be able to coexist as separate dependencies. It should be possible to continue to use
aws-mobile-appsync-sdk-ios
3.6.2 andamplify-swift
2.6.0 alongside each other.Amplify Framework Version
2.6.0
Amplify Categories
API
Dependency manager
Swift PM
Swift version
5.7
CLI version
10.7.3
Xcode version
14.2 (14C18)
Relevant log output
Is this a regression?
No
Regression additional context
No response
Device
N/A - package resolution / build issue
iOS Version
N/A
Specific to simulators
No
Additional context
Also posted on
aws-mobile-appsync-sdk-ios
issues at https://github.com/awslabs/aws-mobile-appsync-sdk-ios/issues/566