did anything change recently with the `create_clou...
# prefect-community
m
did anything change recently with the
create_cloud_hook
mutation? I'm getting the following error:
Copy code
{
  "graphQLErrors": [
    {
      "path": [
        "create_cloud_hook"
      ],
      "message": "Expected type JSON, found {to: \"<mailto:test@test.com|test@test.com>\"}; 'ObjectValueNode' object has no attribute 'value'",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "message": "Expected type JSON, found {to: \"<mailto:test@test.com|test@test.com>\"}; 'ObjectValueNode' object has no attribute 'value'",
          "locations": [
            {
              "line": 2,
              "column": 146
            }
          ],
          "path": null
        }
      }
    }
  ],
  "networkError": null,
  "message": "GraphQL error: Expected type JSON, found {to: \"<mailto:test@test.com|test@test.com>\"}; 'ObjectValueNode' object has no attribute 'value'"
}
I'm pulling the mutation straight out of the docs here This was previously working for me.
Copy code
mutation {
  create_cloud_hook(input: {type: EMAIL, name: "Example", version_group_id: "version-group-id", states: ["Running"], config: {to: "<mailto:test@test.com|test@test.com>"}}) {
    id
  }
}
j
Hi @Mark McDonald - give this construction a shot:
Copy code
mutation {
  create_cloud_hook(input: {type: EMAIL, name: "Example", version_group_id: "abc", states: ["Running"], config: "{\"to\": \"<mailto:test@test.com|test@test.com>\"}"}) {
    id
  }
}
I’m wrapping the entire config object as a JSON literal
We recently updated some of the GraphQL server dependencies and it’s possible inline JSON parsing behavior changed - I will look into it!
(In general, our experience with passing JSON in GraphQL has been that using GQL variables is a much nicer experience; we always seem to run into one or another parsing edge case passing JSON inline)
On closer examination, I think the old behavior wasn’t strictly correct; it was a rough parse of the GQL AST that was almost but not quite JSON:
{to: "<mailto:test@test.com|test@test.com>"}
. The updated server is complaining a lot about invalid objects if I try to force the old behavior, so I think this was considered a bug in the implementation. I’ll update the docs. Thanks for pointing this out!
m
thanks @Jeremiah - that works. And I agree, seeing as how the
to
wasn't actually in quotes isn't valid json. It's strange that that ever worked.
j
Yeah, I am surprised myself, sort of makes sense… but quoting JSON literals is so frustrating.