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
87 stars 73 forks source link

Mock API: Operation BatchPutItem not implemented #856

Open gxxcastillo opened 1 year ago

gxxcastillo commented 1 year ago

Before opening, please confirm:

How did you install the Amplify CLI?

npm

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

v16.13.0

Amplify CLI Version

10.2.1

What operating system are you using?

M1 Mac w/ rosetta terminal

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

Manual changes required to add a mutation resolver that uses the BatchPutItem operation.

Amplify Categories

api

Amplify Commands

Not applicable

Describe the bug

I get the following error when I try and submit a "BatchPutItem" operation using the amplify mock api. I've tried a few different BatchPutItem operations and they all fail with this message.

{
  "data": {...},
  "errors": [
    {
      "message": "Operation  BatchPutItem not implemented",
      "errorType": "UnknownErrorType",
      "data": null,
      "errorInfo": null,
      "path": [...],
      "locations": [...]
    }
  ]
}

Note, I don't get this error when I push my code up and use the hosted environment.

Expected behavior

I would expect the mock api to be able to handle BatchPutItem operations

Reproduction steps

Starting with a new directory:

  1. > amplify init
  2. > amplify add api to create graphql schema with > 1 table + auth
  3. > amplify mock api to run mock api
  4. update resolver for creating an item to use a BatchPutItem
  5. attempt a BatchPutItem on the local mock api by calling the given mutation via the graphql explorer

GraphQL schema(s)

```graphql # Put schemas below this line type User @model @auth(rules: [{ allow: public, provider: iam }]) { name: String blog: Blog @hasOne } type Blog @model @auth(rules: [{ allow: public, provider: iam }]) { id: ID! name: String! } ```

Project Identifier

No response

Log output

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

Additional information

No response

ykethan commented 1 year ago

Hey @gxxcastillo, Thank you for reaching out. Amplify mock api currently does not support this workflow but is supported on the AppSync console. Marking this as a feature request.