Running dgraph/standalone along with dgraph/dgraph-lambda

Report a Dgraph Bug

What version of Dgraph are you using?

I’m trying to run dgraph along with lambda server, using the compose file suggested here

with the following image ids

dgraph/standalone 6c33c6b3864c, dgraph/dgraph-lambda 2e3fbba153b9
$ dgraph version
Dgraph version   : v21.03.0
Dgraph codename  : rocket
Dgraph SHA-256   : b4e4c77011e2938e9da197395dbce91d0c6ebb83d383b190f5b70201836a773f
Commit SHA-1     : a77bbe8ae
Commit timestamp : 2021-04-07 21:36:38 +0530
Branch           : HEAD
Go version       : go1.16.2

Have you tried reproducing the issue with the latest release?


What is the hardware spec (RAM, OS)?

Docker on MacOS

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

I’m trying to run dgraph along with lambda server. When I’m trying to update the schema that contains @lambda directive, the command would return an error that --graphql “lambda-url=…;” flag wasn’t specified during alpha startup. I assume the environment variable DGRAPH_ALPHA_GRAPHQL_LAMBDA_URL would take care of the flag
Using the following docker-compose.yml provided here

version: "3.8"
    image: dgraph/standalone:latest
      DGRAPH_ALPHA_GRAPHQL_LAMBDA_URL: "http://dgraph_lambda:8686/graphql-worker"
      - "8080:8080"
      - "9080:9080"
      - "8000:8000"
      - dgraph:/dgraph

    image: dgraph/dgraph-lambda:latest

      - "8686:8686"
      DGRAPH_URL: http://dgraph:8080
      - ./gql/script.js:/app/script/script.js:ro

  dgraph: {}


type Test {
  number: Float
  luckyNumber: Float @lambda


  "Test.luckyNumber": () => Math.random()

running the command

docker-compose up

then when the server is started run

curl -X POST localhost:8080/admin/schema --data-binary '@gql/schema.gql'

Expected behaviour and actual result.

Expected behaviour:


actual result

{"errors":[{"message":"resolving updateGQLSchema failed because input:3: Type Test; Field luckyNumber: has the @lambda directive, but the --graphql \"lambda-url=...;\" flag wasn't specified during alpha startup.\n (Locations: [{Line: 3, Column: 4}])","extensions":{"code":"Error"}}]}

That’s the issue. You have to build your own standalone image to make it work.

How should I do that? So you are saying that the url is set during the url is set during build time and not container runtime?
I thought DGRAPH_ALPHA_GRAPHQL_LAMBDA_URL was supposed to set a runtime flag equivalent to --graphql lambda-url

Yes, see these files

The standalone runs automatically two nodes. One Zero isntance and an Alpha. So, you won’t add any new param/config to that. You have to copy that files at dgraph/contrib/standalone/ and add the flags manually.

Pay attention that this image wasn’t made for production. If you are investing in some fancy features, you should run your own cluster instead of the standalone.



Good theory, but the machine won’t lie. If it throws the error, is that it isn’t working as expected. Maybe it is an issue with the way Docker build its images. Both nodes are executed in a single shot before the actual execution of the image. In a normal image the binary isn’t executed right away. You have to pass the command in order to run it. But in the standalone, it runs all for you.

1 Like

Thank you so much, I was able to get it working.

Pay attention that this image wasn’t made for production. If you are investing in some fancy features, you should run your own cluster instead of the standalone.

Thanks for the heads-up, this is just for local development. I’m using Dgraph Cloud for production :smiley:

1 Like

I also stumbled on this problem and same as you used the docs to come to the same conclusion.
But after some trial and error and digging it seems to be that

DGRAPH_ALPHA_GRAPHQL: 'lambda-url=http://dgraph_lambda:8686/graphql-worker'

Seems to be the correct input to setup the lambda-url for a alpha server using docker compose