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.

[Bug]: The variables input contains a field name 'modules' that is not defined for input object type 'UpdateRoomInput'

See original GitHub issue

I am getting this error while updating the form of modules resource.

Here’s my schema

type Room
@model
@key(name: "customerIndex", fields: ["customerId"], queryField: "listRoomsByCustomerId")
@auth(rules: [
  { allow: groups, groupsField: "customerId" },
  { allow: groups, groups: ["Admin"] }
]){
  id: ID!
  customerId: ID! # This will be retrieved by scanning
  name: String!
  type: RoomType!
  modules: [Module] @connection(keyName: "byRoom", fields: ["id"])
}

type Module
@model
@key(name: "byRoom", fields: ["roomId"], queryField: "listModulesByRoomId")
@auth(rules: [
  { allow: groups, groupsField: "customerId" },
  { allow: groups, groups: ["Admin"] }
]){
  id: ID! # This will be retrived by scanning
  roomId: ID!
  customerId: ID!
  room: Room @connection(fields: ["roomId"])
  appliances: [Appliance] @connection(keyName: "byModule", fields: ["id"])
}

And here’s my RoomEdit script:

function RoomEdit(props) {
    return (
        <RA.Edit {...props}>
            <RA.TabbedForm>
                <RA.FormTab label="Summary">
                    <RA.TextInput disabled label="Id" source="id"/>
                    <RA.TextInput disabled label="Customer ID" source="customerId"/>
                    <RA.TextInput label="Name" source="name"/>
                    <RA.SelectInput
                        source="type"
                        choices={[
                            {id: "LivingRoom", name: "Living Room"},
                            {id: "BedRoom", name: "Bed Room"},
                            {id: "Kitchen", name: "Kitchen"},
                            {id: "BathRoom", name: "BathRoom"}
                        ]}
                    />
                </RA.FormTab>
                <RA.FormTab label="Modules">
                    <RA.ReferenceManyField reference="modules" target="roomId" addLabel={false}>
                        <RA.Datagrid>
                            <RA.TextField source="id"/>
                            <RA.DateField source="createdAt"/>
                            <RA.DateField source="updatedAt"/>
                            <RA.EditButton/>
                        </RA.Datagrid>
                    </RA.ReferenceManyField>
                </RA.FormTab>
            </RA.TabbedForm>
        </RA.Edit>
    );
}

export default RoomEdit;

I am not sure why am I getting this error. Am I doing anything wrong or Is it a bug in the library?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
MrHertalcommented, Mar 3, 2021

OK maybe you need to remove the modules field when submitting the form. Try with transform attribute, something like:

const editTransform = ({ modules, ...data }) => ({
  ...data,
});

export const RoomEdit = (props) => (
  <Edit {...props} transform={editTransform}>
    ...
  </Edit>
);
0reactions
Niraj-Kamdarcommented, Mar 3, 2021

yeah, it solved the problem. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Amplify: The variables input contains a field name that is ...
I ran into this problem with a Lambda function and found that in order to pass in the correct user properties (owner) I...
Read more >
Error on mutation with new GraphQL Helpers #1399 - GitHub
The variables input contains a field name 'userTalesId' that is not defined for input object type 'CreateTaleInput'.
Read more >
graphql/type
The graphql/type module is responsible for defining GraphQL types and schema. ... An input object type within GraphQL that represents structured inputs.
Read more >
AWS-Amplify/Lobby - Gitter
I get an error: The variables input contains a field name 'task' that is not defined for input object type 'CreateAssignmInput''. I have...
Read more >
graphql-transformer-core - npm
Define a GraphQL object type and annotate it with the @model directive to store objects ... on OBJECT input AuthRule { allow: AuthStrategy!, ......
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