aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
89 stars 76 forks source link

Error trying `amplify mock` "Stream Arn must be specified" #858

Closed duranmla closed 1 year ago

duranmla commented 2 years ago

Before opening, please confirm:

How did you install the Amplify CLI?

yarn

If applicable, what version of Node.js are you using?

16.16.0

Amplify CLI Version

10.2.1

What operating system are you using?

Mac Monterey 12.4

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Amplify Categories

Not applicable

Amplify Commands

Not applicable

Describe the bug

I run amplify mock and fails with "Stream Arn must be specified"

image

Expected behavior

The amplify mock does not fail, perhaps this should be a question issue instead.

What is expected from me to do in this case? What's the Stream Arn and how/where I can specify it?

Reproduction steps

Have a schema with several indexes, run amplify mock adding/removing one index at once per table until the whole initial mock process succeed, then I got the error described above.

GraphQL schema(s)

```graphql # TODO: Split this file in coherent modular files after the issue below has been addressed # https://github.com/aws-amplify/amplify-category-api/issues/711 # in the mean time heavily comment on each section to make it easier to understand # SOL 2.0 # The following link explains the priority for auth rules https://docs.amplify.aws/lib/datastore/setup-auth-rules/q/platform/js/#multiple-authorization-types-priority-order # Relationships insights # ===================== # TIP: Use `amplify codegen models` to check model types before push to cloud # [1] Querying @hasMany side of the relationship is not yet supported by DataStore https://github.com/aws-amplify/amplify-js/discussions/9499 # [2] A model with @hasOne relationship will be deleted when the related model is deleted # [3] When querying models you can't get Children of children, be aware if querying scenarios require it and shape relations accordingly # ...More on the README.md # A representation of a user on its 'participant' role, id will match the Profile.id type Participant @model @auth( rules: [ { allow: private } { allow: public, operations: [read], provider: apiKey } ] ) { # use same id than Profile to make easier the lookups id: ID! profileID: ID! profile: Profile @hasOne(fields: ["profileID"]) skills: [Skill] @manyToMany(relationName: "SkillParticipantConnection") projects: [Project] @manyToMany(relationName: "ProjectParticipantConnection") posts: [Post] @hasMany(indexName: "byParticipant", fields: ["id"]) # see relationship insights [1] # checkups: [Checkup] @hasMany } # A representation of a user on its 'verifier' role, id will match the Profile.id type Verifier @model @auth( rules: [ { allow: private, operations: [read] } { allow: public, operations: [read], provider: apiKey } ] ) { # use same id than Profile to make easier the lookups id: ID! profileID: ID! profile: Profile @hasOne(fields: ["profileID"]) skills: [Skill] @manyToMany(relationName: "SkillVerifierConnection") # see relationship insights [1] # checkups: [Checkup] @hasMany } type Organiser @model @auth( rules: [ { allow: private } { allow: public, operations: [read], provider: apiKey } ] ) { # use same id than Profile to make easier the lookups id: ID! profileID: ID! profile: Profile @hasOne(fields: ["profileID"]) projects: [Project] @manyToMany(relationName: "ProjectOrganiserConnection") } # Represents a domain knowledge type Field @model @auth( rules: [ { allow: private, operations: [read] } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! name: String! image: String! description: String! # see relationship insights [1] # skills: [Skill] @hasMany(indexName: "byField", fields: ["id"]) } # A user ability to participate into a project or to being able to verify certain domain type Skill @model @auth( rules: [ { allow: private, operations: [read] } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! # see relationship insights [1] # fieldID: ID! @index(name: "byField", sortKeyFields: ["level"]) fieldID: ID! priceID: ID productID: ID level: Int @default(value: "0") criteria: String! field: Field @hasOne(fields: ["fieldID"]) verifiers: [Verifier] @manyToMany(relationName: "SkillVerifierConnection") participants: [Participant] @manyToMany(relationName: "SkillParticipantConnection") # Allow optional to permit the ability to generate and relate product/price after skill creation price: Price @hasOne(fields: ["priceID"]) product: Product @hasOne(fields: ["productID"]) } # A transaction object that held the lifecycle of a verification process type Checkup @model @auth( rules: [ { allow: private } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! skillID: ID participantID: ID! verifierID: ID orderID: ID priceID: ID! productID: ID! skill: Skill @hasOne(fields: ["skillID"]) participant: Participant! @hasOne(fields: ["participantID"]) verifier: Verifier @hasOne(fields: ["verifierID"]) content: String feedback: String status: CheckupStatus! @default(value: "PENDING") order: Order @hasOne(fields: ["orderID"]) price: Price! @hasOne(fields: ["priceID"]) product: Product! @hasOne(fields: ["productID"]) } # The different states a checkup can be in enum CheckupStatus { # The checkup payment is being processed SETTLING # There is a checkup available but is not ready to be reviewed PENDING # The skill is assigned but the verifier is not yet assigned SENT # The verifier is assigned but the feedback is not yet given ASSIGNED # The feedback is given and the checkup is completed ACCEPTED REJECTED } # The actual projects that people can work on type Project @model @auth( rules: [ { allow: private } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! name: String! description: String! location: String! problem: String! solution: String! launchPlan: String! status: ProjectStatus! @default(value: "DRAFT") tags: [Tag] @manyToMany(relationName: "ProjectTagConnection") organisers: [Organiser] @manyToMany(relationName: "ProjectOrganiserConnection") participants: [Participant] @manyToMany(relationName: "ProjectParticipantConnection") posts: [Post] @hasMany(indexName: "byProject", fields: ["id"]) } enum ProjectStatus { DRAFT REVIEW PUBLISHED COMPLETED ARCHIVED } # Allow to classify projects among others models type Tag @model @auth( rules: [ { allow: private } # This allow lambda to make CRUD operations { allow: private, provider: iam } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! name: String! image: String! projects: [Project] @manyToMany(relationName: "ProjectTagConnection") # Tag with lower number will be shown first priority: Int @default(value: "1000") } type Membership @model @auth( rules: [ { allow: private } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! profileID: ID! trackingID: ID! stripeSubscriptionID: ID status: MembershipStatus! @default(value: "INACTIVE") profile: Profile @belongsTo(fields: ["profileID"]) } enum MembershipStatus { ACTIVE INACTIVE } # SOL 1.0 # Allow to describe the lifecycle of a user purchase enum OrderStatus { PENDING PROCESSING SUCCEEDED PAYMENT_FAILED } # Define the type of items that can be sell at Sol enum ProductType { VERIFICATION MEMBERSHIP } # Wether the price is mean to be paid in subscription or not enum PriceType { one_time recurring } enum CognitoGroup { admin user guest participant verifier } enum ReputationTargetType { POST PROFILE } enum ReputationType { LOVE CRED } # A model to represent project updates through time in a form of a short tweet like post # project will use open graph to fetch image preview, if a url not provided # the image will be the one provided by the 'image' field if neither is provided # there is no image preview type Post @model @auth( rules: [ { allow: public, operations: [read], provider: apiKey } { allow: private, operations: [read] } { allow: owner } { allow: groups groups: ["Admins"] operations: [read, create, update, delete] } ] ) { id: ID! owner: String @auth( rules: [ { allow: owner, operations: [read, delete] } { allow: public, operations: [read], provider: apiKey } ] ) url: String openGraphData: AWSJSON image: String content: String! authorID: ID! @index(name: "byParticipant") author: Participant @belongsTo(fields: ["authorID"]) projectID: ID! @index(name: "byProject") project: Project! @belongsTo(fields: ["projectID"]) totalLove: Int @default(value: "0") totalCred: Int @default(value: "0") } type Profile @model @auth( rules: [ { allow: public, operations: [read], provider: apiKey } { allow: owner } { allow: private, operations: [read] } ] ) { id: ID! owner: String @auth( rules: [ { allow: owner, operations: [read, delete] } { allow: public, operations: [read], provider: apiKey } ] ) bio: String companies: [Company] @manyToMany(relationName: "ProfileCompanyConnection") email: String! familyName: String languages: [String] links: [String] locale: String name: String picture: String preferredUsername: String! professions: [Profession] @manyToMany(relationName: "ProfileProfessionConnection") totalLove: Int @default(value: "0") totalCred: Int @default(value: "0") membershipID: ID membership: Membership @hasOne(fields: ["membershipID"]) } type Company @model @auth( rules: [ { allow: private, operations: [create, read, update] } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! name: String! slug: String profiles: [Profile] @manyToMany(relationName: "ProfileCompanyConnection") } type Profession @model @auth( rules: [ { allow: private, operations: [create, read, update] } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! name: String! slug: String profiles: [Profile] @manyToMany(relationName: "ProfileProfessionConnection") } ## Stores a Creator's private stripe info type StripeProfile @model @auth( rules: [ { allow: owner } # TODO: avoid the need of the public read auth as this models intent to be private. # subcriptions: { level: off } while remove the subscriptions queries, yields error such as # "Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field 'onUpdateStripeProfile' in type 'Subscription' is undefined @ 'onUpdateStripeProfile'"}]}" { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! owner: String @auth( rules: [ { allow: owner, operations: [read, delete] } { allow: public, operations: [read], provider: apiKey } ] ) solUserID: ID! stripeAccessID: ID! stripeUserID: ID! } ## Used to store private information for a given user ## Publically shared info must go into Profile type Vault @model @auth( rules: [ { allow: owner } # TODO: avoid the need of the public read auth as this models intent to be private. # subcriptions: { level: off } while remove the subscriptions queries, yields error such as # "Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field 'onUpdateStripeProfile' in type 'Subscription' is undefined @ 'onUpdateStripeProfile'"}]}" { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! owner: String @auth( rules: [ { allow: owner, operations: [read, delete] } { allow: public, operations: [read], provider: apiKey } ] ) userID: ID! # TODO: move this attr to StripeProfile but we need to update lambda functions first stripeCustomerID: ID! } # Store all user's created products type Product @model @auth( rules: [ { allow: private, operations: [create, read] } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! title: String! description: String image: String active: Boolean type: ProductType! metadata: AWSJSON prices: [Price] @hasMany stripeProductID: ID! # Allows to send payments after the product is being bought to the user that created the product makerID: ID maker: Profile @hasOne(fields: ["makerID"]) } # Allow each product to have different pricing options. Emulates Stripe product/price model # https://stripe.com/docs/products-prices/how-products-and-prices-work#what-is-a-price type Price @model @auth( rules: [ { allow: private, operations: [create, read] } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! amount: Float! metadata: AWSJSON type: PriceType! stripePriceID: ID! productID: ID! product: Product! @belongsTo } type Reputation @model @auth( rules: [ { allow: private, operations: [create, read] } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! targetID: ID! targetType: ReputationTargetType! profileID: ID! type: ReputationType! value: Int! } # Keep the record of all orders created by a user within the system type Order @model @auth( rules: [ { allow: private, operations: [create, read] } { allow: public, operations: [read], provider: apiKey } ] ) { id: ID! productID: ID! priceID: ID! buyerID: ID! sellerID: ID! status: OrderStatus! trackingID: ID! stripePriceID: ID! stripeProductID: ID! metadata: AWSJSON } ```

Project Identifier

976fd779f41a5b0cbe838e291735690e

Log output

``` # Put your logs below this line ```

Additional information

No response

mstoyanovv commented 1 year ago

Hi @duranmla, could you try to update to the latest amplify version and delete the 'amplify/mock-data', 'amplify/mock-api-resources' folders. I had similar issue and resolved it that way as I think there was a corrupted file.

duranmla commented 1 year ago

I would love to work with latest version but I can't due to https://github.com/aws-amplify/amplify-cli/issues/9508#issuecomment-1283655867 and https://github.com/aws-amplify/amplify-codegen/issues/509 whenever I am able to go to latest I will try again.

mstoyanovv commented 1 year ago

Still worth to try the proposed without updating to latest version.

AnilMaktala commented 1 year ago

Hey @duranmla, Are you still experiencing the issue?

phani-srikar commented 1 year ago

Please re-open if you're still experiencing the issue.