Upgraded to v1.2.0-beta.4 and have run into an error while creating action relationships.
A table has an "id" (uuid) and an action has a result type with an "id" field. When creating an object relationship it errors with the following:
[
{
"definition": {
"input_objects": [
{
"name": "MyActionInput",
"description": null,
"fields": [
{
"name": "id",
"type": "uuid!",
"description": null
},
{
"name": "message",
"type": "String!",
"description": null
}
]
}
],
"objects": [
{
"name": "MyActionResult",
"relationships": [
{
"remote_table": {
"schema": "public",
"name": "test"
},
"name": "test",
"type": "object",
"field_mapping": {
"id": "id"
}
}
],
"description": null,
"fields": [
{
"arguments": null,
"name": "id",
"type": "uuid!",
"description": null
}
]
}
],
"scalars": [],
"enums": []
},
"reason": "validation for the given custom types failed because the field \"id\" for relationship \"test\" in object type \"MyActionResult\" does not exist",
"type": "custom_types"
}
]
It can be reproduced in the following clean installation and metadata below
https://hasura-issue-4447.herokuapp.com/console/actions/manage/myAction/relationships
Hey noticed the schema didn't automatically create the scalar type for uuids. Seems to be the issue, add scalar uuid to your custom types and it should work.
@sdkayy that was a great tip, it works when adding scalar uuid on actions.graphql. Hasura properly validates the uuid on the response from the webhook. Crucially, I didn't list the scalar on actions.yaml
example here: https://hasura-actions-pete-test.herokuapp.com
webhook here: https://glitch.com/edit/#!/hasura-issue-47?path=server.js:26:36
mutation:
mutation {
myAction(stuff: { id: "a61c1827-987d-45a2-9951-78219a1facd9", message: "asd" }) {
id
test {
id
}
}
}
response:
{
"errors": [
{
"extensions": {
"path": "$",
"code": "data-exception"
},
"message": "invalid input syntax for type uuid: \"this is not a uuid\""
}
]
}
thank you!
Most helpful comment
Hey noticed the schema didn't automatically create the scalar type for uuids. Seems to be the issue, add
scalar uuidto your custom types and it should work.