What I want to do
I want to know how to update lambda functions when using Dgraph v23.0.1
What I did
Previously for Dgraph v21.12.0, I used helm install Dgraph chart, I have settings of alpha
like this:
alpha:
extraEnvs:
- name: lambda
value: url=http://dgraph-lambda-dgraph-lambda.demo.svc:8686/graphql-worker
And settings of Lambda
like this:
image:
tag: 1.2.4
service:
type: ClusterIP
port: 8686
targetPort: 8686
env:
- name: DGRAPH_URL
value: http://dgraph-release-dgraph-alpha-headless.demo.svc:8080
Everything works perfectly. I can send a http post to endpoint: http://localhost:8080/admin
using Postman with the body like this to update Lambda functions.
mutation{
updateLambdaScript(input:{set:{script:
"""async function myFunction({graphql}) {
const results = await graphql(`query {
queryProductVersion {
version
categoriesAggregate {
count
}
}}`)
return results.data.queryProductVersion.map(parseResult)
}
const parseResult = (item) => {
return { id: item.version, label: item.version, value: item.categoriesAggregate.count}
}
addGraphQLResolvers({
"Query.myFunction": myFunction,
})
"""
}}){
lambdaScript{script}
}
}
But ever since I upgraded Dgraph to v23.0.1, meanwhile used the same version of lambda
and the configuration, even though the changes I made to the settings of alpha
works, I can No Longer update lambda functions using the prior method.
alpha:
extraEnvs:
- name: DGRAPH_ALPHA_GRAPHQL
value: lambda-url=http://dgraph-lambda-dgraph-lambda.demo.svc:8686/graphql-worker
Sending a http post to endpoint: http://localhost:8080/admin
using Postman with the body as above returns error like this:
"errors": [
{
"message": "Cannot query field \"updateLambdaScript\" on type \"Mutation\".",
"locations": [
{
"line": 2,
"column": 2
}
]
}
],
Then I tried what’s suggested in the doc Lamda on my self-hosted Dgraph on aws with Postman. It returned error like:
Dgraph metadata
Only happens on v23.0.1