Custom DQL not working out side of api explorer

I cant figure out why my Custom DQL queries are not working.

type Query {
  
  SearchUser(search: String!): [User] @custom(dql: """
		query q($search: string) {
   		    SearchUser(func: match(User.id,$search, 3), first: 3) {
    		        id: User.id
    		        name: User.name
    		        preview: User.preview
                    }
                }
  """)
}

When I run the query in the API Explorer everything works.

But if I try to run it from apollo get;

{“errors”:[{“message”:“no query string supplied in request”}]}

query MyQuery($search: String!) {
    SearchUser(search: $search) {
          id
      }
  }

And when I try to fetch it I get: message: “Operations not allowed – [SearchUser]”
even though I don’t have any auth set up

fetch("https://dawn-wind.us-west-2.aws.cloud.dgraph.io/graphql", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      query: `query MyQuery {
        SearchUser(search: "badwithawp") {
          id
        }
      }
`,

All my other queries work,
Any suggestions would be great.

1 Like

What queries do you see available with introspection? Does this custom query show there?

yeah it shows up in the document explorer :

SearchUser(search: String!): [User]

Well turns out lambda function access needed to be turned on.

probs should put that in the docs somewhere…

3 Likes

How is the access turned on?