.mergeV() with Javascript not working
Hi, I have a nodeJS 18 lambda which is closely modeled after this documentation: https://docs.aws.amazon.com/neptune/latest/userguide/lambda-functions-examples.html#lambda-functions-examples-javascript
here is my async query function:
This code produces the following vertex, without using the userId or label which I provided:
How can I troubleshoot this function? I'm using Neptune 1.2.1.0 with a nodeJs 18 lambda and here is an excerpt from my package.json and yarn.lock which shows the gremlin versions which yarn resolved for my project
AWS Lambda function examples for Amazon Neptune - Amazon Neptune
The following example AWS Lambda functions, written in Java, JavaScript and Python, illustrate upserting a single vertex with a randomly generated ID using the fold().coalesce().unfold() idiom.
Solution:Jump to solution
The solution was to allow neptune to use the default mimetype; removing the mimetype header solved the issue
12 Replies
logging the response shows me this:
what is the type of
userId
?userId is a string
Is it possible the vertex already existed?
no unfortunately, I'm testing this new lambda with a empty neptune db, created for this purpose
Now I've changed/simplified the query function to this:
But the result is similar,
and the vertex created is this:
it seems like mergeV on javascript is not eager to comply with my expectations :/
@salman_walmart This is the question I was telling you about
I can't seem to get mergeV to work
It creates a vertex without considering the map that I provide, it seems like I'm using the wrong syntax but it's the same syntax that is generated by the gremlator tool https://www.gremlator.com/
Gremlator
Gremlin Language Variant Translator for Apache Tinkerpop
Now when I instrument the function a bit more, I'm seeing that there is something wrong with the map that I'm creating:
the logs show
As deployed in Lambda the code appears like this:
I'm not sure what
/* @__PURE__ */
means
Now I've updated my function to
and the logs show
So it seems that the map was populated after all, and my logging was just representing it as {}.
so the problem remainsI just tried this using gremlin-javascript 3.6.2:
Same query:
g.mergeV(new Map([[t.label,"person"],["name","marko"],["age",29]])).next()
And got this result:
Running element map on that id returns:
ooh nice that's what I want to see
I provided some more details in an amazon case which I just created, can I send you that case #?
yes, please
Thank you!
Solution
The solution was to allow neptune to use the default mimetype; removing the mimetype header solved the issue