Lambda Resolvers (Query, Mutation) Always Return 400

Report a Dgraph Bug

What version of Dgraph are you using?

Latest (20.11)

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

I am using Docker

Steps to reproduce the issue (command/config used to run Dgraph).

I am following the steps in the guide at https://dgraph.io/docs/graphql/lambda/server/. I also used the example type and mutation for newAuthor at https://dgraph.io/docs/graphql/lambda/mutation/. I am unable to get the provided example to work. I did have to modify the docker-compose.yml file to not contain -o 100 - for some -o 100 breaks prevents alpha from connecting to zero.

Attachments

docker-compose.yml (677 Bytes)
schema.graphql (662 Bytes)
lambda.js (2.1 KB)

Expected behaviour and actual result.

I am experiencing problems with Lambda Mutations / Queries. I even tried using the example above, but received the following error. I am not having any issues with the Lambda Fields - these are working for me, so if I do fullName backed my a Lambda, this works. Only with Lambda Queries and Lambda Mutations. I have tried using dgraph/dgraph with tags v20.11.0, latest, master, etc, with no success.

{
  "errors": [
    {
      "message": "Evaluation of custom field failed because external request returned an error: unexpected error with: 400 for field: newAuthor within type: Mutation.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    },
    {
      "message": "Non-nullable field 'newAuthor' (type ID!) was not present in result from Dgraph.  GraphQL error propagation triggered.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "newAuthor"
      ]
    }
  ],
  "extensions": {}
}```

OK so I tried to reproduce the issue…and I ran into other issues that is not like yours. There are some infelicities in the docs. Let me work thru those things first. I will do a write up when done.

Sounds good, thanks!

@docs wanna take a look as well? I had some issues even getting the docker thing working. I think the docs are out of date. I’m working on another issue atm, so if someone else could take this it’d be great. Otherwise I’ll take a look in 1 day’s time.

@abhimanyusinghgaur could you review our Lambda docs, just to be sure that we didn’t miss anything or made any mistakes? thanks! :slight_smile:

@chewxy could you please provide the error that you are facing?

Any changes? Looks like everyone needs an example of your error

I have an example of my error above. I have had no success following the docs. It looks like @chewxy experienced issues with getting the Docker setup working.

1 Like

I think I am having the same issue even with slash

1 Like

@btks that’s corect.

@pbassham Can you elaborate? This shouldn’t be the case for Slash

nevermind. i think i got it resolved. all good