question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$[_version] for amplify graphql v2 error

See original GitHub issue

Before opening, please confirm:

JavaScript Framework

Not applicable

Amplify APIs

GraphQL API

Amplify Categories

No response

Environment information

# Put output below this line
System:
    OS: macOS 12.0.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
    Memory: 35.43 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.4.2 - /usr/local/bin/node
    Yarn: 1.22.11 - /usr/local/bin/yarn
    npm: 6.14.15 - ~/node_modules/.bin/npm
    Watchman: 2021.08.30.00 - /usr/local/bin/watchman
  Browsers:
    Brave Browser: 95.1.31.88
    Chrome: 92.0.4515.107
    Safari: 15.1
  npmGlobalPackages:
    @aws-amplify/cli: 7.6.2
    @vue/cli: 4.5.15
    n: 8.0.1
    npm: 8.2.0


Describe the bug

when updating or deleting an item I get error message: "Value for field '$[_version]' must be a number."

my schema is

type BodyArea
  @model
  @auth(
    rules: [
      { allow: public, operations: [read] }
      { allow: groups, groups: ["admin"], operations: [read] }
      { allow: private }
    ]
  ) {
  id: ID!
  key: String!
  name: String!
  symptoms_common: [Symptom] @manyToMany(relationName: "BodyAreaSymptomCommon")
  symptoms_all: [Symptom] @manyToMany(relationName: "BodyAreaSymptomAll")
  body_parts: [BodyPart] @hasMany(indexName: "byBodyArea", fields: ["id"])
}

type BodyPart
  @model
  @auth(
    rules: [
      { allow: public, operations: [read] }
      { allow: groups, groups: ["admin"], operations: [read] }
      { allow: private }
    ]
  ) {
  id: ID!
  key: String!
  name: String!
  symptoms_common: [Symptom] @manyToMany(relationName: "BodyPartSymptomCommon")
  symptoms_all: [Symptom] @manyToMany(relationName: "BodyPartSymptomAll")
  body_area_id: ID! @index(name: "byBodyArea", sortKeyFields: ["key"])
  body_area: BodyArea @belongsTo(fields: ["body_area_id"])
}

type Symptom
  @model
  @auth(
    rules: [
      { allow: public, operations: [read] }
      { allow: groups, groups: ["admin"], operations: [read] }
      { allow: private }
    ]
  ) {
  id: ID!
  key: String!
  name: String!
  body_area_common: [BodyArea] @manyToMany(relationName: "BodyAreaSymptomCommon")
  body_area_all: [BodyArea] @manyToMany(relationName: "BodyAreaSymptomAll")
  body_part_common: [BodyPart] @manyToMany(relationName: "BodyPartSymptomCommon")
  body_part_all: [BodyPart] @manyToMany(relationName: "BodyPartSymptomAll")
}

Expected behavior

deletes/updates as expected

Reproduction steps

I made initial backend in admin-ui with auth and made schema with cli. I’m using sveltekit but don’t think thats relevant

create. item

mutation CreateBodyPart($key: String!, $name: String!, $body_area_id: ID!) {
    createBodyPart(input: {
      key: $key,
      name: $name,
      body_area_id: $body_area_id
    }) {
      id
      key
      name
      body_area_id
    }
  }

delete item

mutation DeleteBodyPart($id: ID!) {
  deleteBodyPart(input: {id: $id }){
    id
  }
}

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
24jrcommented, Dec 9, 2021

@chrisbonifacio I appreciate you helping me! Ok I did already add maybe 100 parts but not the end of the world if have to re add those. Ok I will make a new one and start with datastore enabled from the get-go to avoid this and do that maybe tomorrow and see if that works. Thanks again!

0reactions
github-actions[bot]commented, Dec 11, 2022

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while migrating to GraphQL transformer V2 #9646
I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists. I have searched for...
Read more >
GraphQL Transformer v1 to v2 migration - AWS Amplify Docs
This tool will automatically migrate many schema scenarios for you. It is recommended to test your migrated schema in a development environment.
Read more >
AWS Amplify announces the new GraphQL Transformer v2. ...
Today, AWS Amplify announces the GraphQL Transformer version 2, enabling developers to develop more feature-rich, flexible, and extensible  ...
Read more >
AWS Amplify migrate GraphQLTransformer to V2
The GraphQL Transformer version is managed in amplify/cli.json. You simply need to edit the file and set the following two properties:
Read more >
Vue js amplify error while deleting GraphQL data (error type
Hi, I got an error when I created CRUD App using vue.js and AWS Amplify. Create and Read data working correctly, but when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found