aws-amplify/amplify-swift

Will not compile Swift - Relationship data fields

bargeboss-chris opened this issue · 7 comments

Describe the bug

Will not compile

Steps To Reproduce

Steps to reproduce the behavior:
1. open xcode15.3
2. open existed AWS project
3. build all
4. See error(Cannot convert value of type '(any Error) -> Void' to closure result type '()' in Attempt.swift amplify-swift/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/Attempt.swift)

Expected behavior

code to compile

Amplify Framework Version

2.35.4

Amplify Categories

DataStore

Dependency manager

Swift PM

Swift version

5.10

CLI version

12.12.4

Xcode version

Xcode 15.4 Build version 15F31d

Relevant log output

<details>
<summary>Log Messages</summary>


INSERT LOG MESSAGES HERE
```

Is this a regression?

Yes

Regression additional context

No response

Platforms

No response

OS Version

14.5

Device

Mac air M3

Specific to simulators

No response

Additional context

No response

@bargeboss-chris I am not able to reproduce this issue on Xcode 15.3. Can you provide more details about your environment? Is there any specific build settings that are being used in the project? More context and details would be nice to investigate this further.

@harsh62

We have attempted to build a file on Xcode 15.3 and 15.4 both are installed on the machine that is doing the development.

We have updated to the newest 2.35.4.

We were able to build the Xcode file if no relational (one to one - one to many - many to many) fields are used in the data schema.

As soon as a relational field is added, the Xcode fill will not build.

Swift 5.10 version

We are using all standard build settings nothing has been changed from default.

Amazon CLI version: aws --version
aws-cli/2.17.10 Python/3.11.8 Darwin/23.5.0 exe/x86_64

Screenshot 2024-07-09 at 9 05 53 PM Screenshot 2024-07-09 at 9 06 47 PM Screenshot 2024-07-09 at 9 06 55 PM Screenshot 2024-07-09 at 9 07 05 PM Screenshot 2024-07-09 at 9 07 41 PM Screenshot 2024-07-09 at 9 08 04 PM Screenshot 2024-07-09 at 9 11 15 PM Screenshot 2024-07-09 at 9 11 25 PM Screenshot 2024-07-09 at 9 11 33 PM Screenshot 2024-07-09 at 9 11 43 PM Screenshot 2024-07-09 at 9 11 51 PM Screenshot 2024-07-09 at 9 11 59 PM Screenshot 2024-07-09 at 9 12 06 PM Screenshot 2024-07-09 at 9 12 15 PM Screenshot 2024-07-09 at 9 12 24 PM Screenshot 2024-07-09 at 9 12 33 PM Screenshot 2024-07-09 at 9 12 41 PM

@bargeboss-chris

I am still unable to repro the issue. I followed this documentation to setup a new DataStore project and used a relational model. My schema looks as follows:

input AMPLIFY { globalAuthRule: AuthRule = { allow: public } } # FOR TESTING ONLY!

type Blog @model {
  id: ID!
  name: String!
  posts: [Post] @hasMany
}

type Post @model {
  id: ID!
  title: String!
  blog: Blog @belongsTo
  comments: [Comment] @hasMany
}

type Comment @model {
  id: ID!
  post: Post @belongsTo
  content: String!
}

And everything is just working fine. Would you be able to follow the documentation from scratch and see if it works for you?

Screenshot 2024-07-15 at 4 33 13 PM Screenshot 2024-07-15 at 4 33 25 PM

I'm running into the same issue when running code gen for Amplify gen 2.

@ethan021021 Thanks for mentioning that this problem happens on Gen2. We have a fix and will cut a release soon.

@ethan021021 @bargeboss-chris Amplify has released a new version with the fix. Please use the latest version of Amplify.

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.