aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.32k stars 248 forks source link

Amplify.Hub.listen never get "ready" #4893

Closed harrynguyenangle closed 5 months ago

harrynguyenangle commented 5 months ago

Description

Currently I have upgrade Amplify Gen 1 Flutter v1 Libaries from pubspec.yaml amplify_flutter: ^1.8.0 amplify_auth_cognito: ^1.8.0 amplify_datastore: ^1.8.0 amplify_api: ^1.8.0 amplify_storage_s3: ^1.8.0 amplify_analytics_pinpoint: ^1.8.0

My codes worked before, everytime app opens, it can trigger 'ready' and network is up, data is all sync to cloud Now, after changing some schema, remove schema model (by command amplify push --allow-destructive-graphql-schema-updates) And upgrade Amplify CLI the latest version, -> run the app, print (hubeventname) It never gets "ready", it just got "syncQueriesStarted" so far Then I test with Amplify.Datastore.save, it does not upload to Database

Categories

Steps to Reproduce

Screenshots

Screenshot 2024-05-16 at 00 17 55

Platforms

Flutter Version

3.22.0

Amplify Flutter Version

12.12.0

Deployment Method

Amplify CLI

Schema

No response

NikaHsn commented 5 months ago

@harrynguyen2510 thanks for taking the time to raise this issue. While we investigate could you please provide answers to the following questions:

harrynguyenangle commented 5 months ago
NikaHsn commented 5 months ago

@harrynguyen2510 thanks for providing these info. Is this issue exclusive to iOS, or does it also happen in Android? could you please provide both the original and updated schemas?

harrynguyenangle commented 5 months ago

I didn't test on Android, but I tested on 3 iOS devices, and it happened the same bug.

Here is current Schema type User @model @auth(rules: [{allow: public}]) { id: ID! authenticateID: String! username: String! fullname: String! email: String! phonenumber: String password: String profilepicKey: String bio: String resign: Boolean isDeveloperPermit: Boolean isActive: Boolean updateUserType: String oneSignalID: [String] updateOneSignalIDType: String platform: String deviceToken: [String] updateDeviceTokenType: String userPermission: [String] updateUserPermissionType: String authority: [String] updateAuthorityType: String followingUserids: [String] updateFollowingType: String followedbyUserids: [String] updateFollowedbyType: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type EmployeeCode @model @auth(rules: [{allow: public}]) { id: ID! ecode: String! name: String! dob: String! title: String! confirmemail: Boolean email: String department: String! connectUser: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type Member @model @auth(rules: [{allow: public}]) { id: ID! admin: Boolean userID: String! onChatroomid: String onGroupid: String updatedAt: AWSDateTime createdAt: AWSDateTime }

type FollowRelation @model @auth(rules: [{allow: public}]) { id: ID! followerID: String! followeeID: String! createdAt: AWSDateTime updatedAt: AWSDateTime }

type Chatroom @model @auth(rules: [{allow: public}]) { id: ID! chatgrouppickey: String chatgroupName: String isGroup: Boolean lastupdateTime: String! lastupdateDate: String! createdbyUserID: String! isDeleted: Boolean updateType: String adminID: [String] updateAdminType: String members: [String] updateMemberType: String isPinnedByUserIDs: [String] updatePinType: String isNewMessageForUserIDs: [String] updateHaveNewMessageType: String userIDsTyping: [String] updateTypingType: String createdAt: AWSDateTime updatedAt: AWSDateTime currentSeenByUserids: [String] allowChangeUI: Boolean lastMessage: String lastMessageid: String }

type MessageItem @model @auth(rules: [{allow: public}]) { id: ID! content: String filekey: [String] hasFile: Boolean contenttype: String! replyFromMessageid: String sentbyUserID: String! onChatroomID: String! isforward: Boolean isDeleted: Boolean withPollID: String isLastMessageOnRoom: Boolean updateMessageType: String reactedBy: [String] updateReactType: String currentlySeenBy: [String] updateSeenType: String savedby: [String] updateSaveType: String createdTime: String createdDate: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type ReactionItem @model @auth(rules: [{allow: public}]) { id: ID! reactionType: String! reactedbyUserID: String! onMessageitemID: String! onChatroomID: String! createdAt: AWSDateTime updatedAt: AWSDateTime }

type SaveMessage @model @auth(rules: [{allow: public}]) { id: ID! savedbyUserID: String! atMessageitemID: String! onChatroomID: String! createdAt: AWSDateTime updatedAt: AWSDateTime }

type GroupPost @model @auth(rules: [{allow: public}]) { id: ID! groupname: String! grouppic: String createdby: String! updateGroupPostType: String adminID: [String] updateAdminType: String members: [String] updateMemberType: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type Post @model @auth(rules: [{allow: public}]) { id: ID! content: String! filekey: [String] hasFile: Boolean withPollID: String postedbyUserID: String! postedonGroupID: String isEdited: Boolean updatePostType: String pinDueDate: String isPinDepartment: Boolean isPinGlobal: Boolean pinGlobalForSpecific: [String] updatePinGlobalForSpecificType: String likeByUserids: [String] updateLikeType: String savedby: [String] updateSaveType: String createdTime: String craatedDate: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type Comment @model @auth(rules: [{allow: public}]) { id: ID! content: String onPostid: String commentedbyUserID: String filekey: [String] hasFile: Boolean isEdited: Boolean updateCommentType: String likeByUserids: [String] updateLikeType: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type Reply @model @auth(rules: [{allow: public}]) { id: ID! content: String onCommentid: String onPostid: String repliedbyUserID: String filekey: [String] hasFile: Boolean isEdited: Boolean updateReplyType: String likeByUserids: [String] updateLikeType: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type PollContent @model @auth(rules: [{allow: public}]) { id: ID! createdByUserid: String! title: String! filekey: [String] hasFile: Boolean pollDueDate: String allowSelect: Boolean! mutipleSelect: Boolean updatePollType: String optionOne: String! optionOneVoteByUserids: [String] updateOptionOneType: String optionTwo: String! optionTwoVoteByUserids: [String] updateOptionTwoType: String optionThree: String optionThreeVoteByUserids: [String] updateOptionThreeType: String optionFour: String optionFourVoteByUserids: [String] updateOptionFourType: String optionFive: String optionFiveVoteByUserids: [String] updateOptionFiveType: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type Like @model @auth(rules: [{allow: public}]) { id: ID! onPostid: String onCommentid: String onReplyid: String likedbyUserID: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type SavePost @model @auth(rules: [{allow: public}]) { id: ID! savedby: String atPostid: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type Bell @model @auth(rules: [{allow: public}]) { id: ID! sentbyUserID: [String!]! updateSentByType: String toUserID: String! belltype: String! didRead: Boolean! postid: String commentid: String replyid: String groupid: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type AnonymousQuery @model @auth(rules: [{allow: public}]) { id: ID! content: String! didRead: Boolean! adminResponse: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type UserPermission @model @auth(rules: [{allow: public}]) { id: ID! key: String! value: String! forUserid: String! createdAt: AWSDateTime updatedAt: AWSDateTime }

type UserAuthority @model @auth(rules: [{allow: public}]) { id: ID! userID: String! authority: String! createdAt: AWSDateTime updatedAt: AWSDateTime }

type SpecialObject @model @auth(rules: [{allow: public}]) { id: ID! type: String! key: String! value1: String! value2: String value3: String value4: String value5: String value6: String value7: String value8: String value9: String value10: String createdAt: AWSDateTime updatedAt: AWSDateTime }

type BugDetect @model @auth(rules: [{allow: public}]) { id: ID! userid: String! bug: String! createdAt: AWSDateTime updatedAt: AWSDateTime }

This is a schema I removed currently (did remove others some before, but worked normally)

type MediaFileRatio @model @auth(rules: [{allow: public}]) { id: ID! filekey: String! ratio: Float! }
I deleted all data on this model, then delete on schema.graphql, amplify codegen models, amplify push, then deploy on studio

Another question that I see some amplify flutter plugins are 2.0.0. Are these for Gen 2 or just upgrade version for Gen 1? Thanks

NikaHsn commented 5 months ago

@harrynguyen2510 thank you for providing these details. we will look into this issue and get back to you with any updates.

re: Another question that I see some amplify flutter plugins are 2.0.0. Are these for Gen 2 or just upgrade version for Gen 1?

The latest version of the Amplify Flutter library is 2.0.0, which currently supports Gen1 configurations through amplifyconfiguration.dart. you can use either Amplify Gen1 or Gen2 to setup your backend. With Amplify Gen2, you must use the --outputs-version 0 flag with ampx command. Development for supporting Gen2 with --outputs-version 1 is in progress, you can follow #4834 for update.

harrynguyenangle commented 5 months ago

The cause of issue is that I mistakely change attribute name of schema model while the model on cloud, on that attribute, currently having values. So it was error for sync Resolved by deleting these data of schema model in DynamoDB, then it works normally