0

This is code section.. companyStatus: userCtx.user.category this section is generating error in the code. This field is actually enum type field in the schema.graphql Can anyone please help me how to write that section? companyName is working fine, but getting error from company Status.

ERROR : companyType has an invalid value, this is the error

var input = {
        companyName: userCtx.user.company,
        companyStatus: userCtx.user.status 
        createdAt: new Date().toISOString()
    }
  • What is the value of `userCtx.user.category` ? Is it a string or number ? Also, what are the possible values of this enum called `companyStatus` as per the graphql schema on the backend ? – Emmanuel Ponnudurai Sep 03 '21 at 19:35
  • Hey Thank you for getting back. companyStatus is field type companyStatus. Schema.graphql enum companyStatus { active pending inactive delete } userCtx.user.category is pending – Priyam Ghosh Sep 04 '21 at 05:51
  • The thing is when I am adding the query from appsync, it's working as I am using pending without "" double quotes. But in react code, that double quotes is again coming in, I hope the error is for that reason. – Priyam Ghosh Sep 04 '21 at 05:54
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 08 '21 at 12:48

1 Answers1

0

I solved the issue. The code was all ok. My Schema was

companyStatus {
pending
active
inactive
}

In the code where I was receiving the enum value

companyStatus: userCtx.user.status

userCtx.user.status value was previously Pending, P in caps, so that was the issue. When I changes Pending to pending, it got solved. Thanks.

lejlun
  • 4,140
  • 2
  • 15
  • 31