'I'm try to add subscription with graphql but it is throwing an error "Not Authorized to access onCreateMessage on type Subscription"

I'm building a simple chat app with aws amplify but when I tried to add graphql subscribe to onMessageCreate it is throwing an error "Not Authorized to access onCreateMessage on type Subscription", I have added auth rule {allow: private}

type Message @model @auth(rules: [{ allow: private, provider: userPools }]) { id: ID! owner: String! message: String! }



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source