© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Apache TinkerPopAT
Apache TinkerPop•2y ago•
27 replies
danielcraig23

.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:
async function query(context) {
    const { userId } = context;
    return g
        .mergeV(new Map([[t.id, userId]]))
        .option(
            merge.onCreate,
            new Map([
                [t.label, 'myLabel']
            ])
        )
        .next();
}
async function query(context) {
    const { userId } = context;
    return g
        .mergeV(new Map([[t.id, userId]]))
        .option(
            merge.onCreate,
            new Map([
                [t.label, 'myLabel']
            ])
        )
        .next();
}


This code produces the following vertex, without using the userId or label which I provided:
gremlin> g.V().elementMap()
==>[id:84c77791-6b38-6c39-c63a-4f0a84d3058e,label:vertex]
gremlin> g.V().elementMap()
==>[id:84c77791-6b38-6c39-c63a-4f0a84d3058e,label:vertex]


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
    "dependencies": {
        "date-fns": "^2.30.0",
        "gremlin": "3.6.2",
        "gremlin-aws-sigv4": "^3.6.1"
    }
    "dependencies": {
        "date-fns": "^2.30.0",
        "gremlin": "3.6.2",
        "gremlin-aws-sigv4": "^3.6.1"
    }


"gremlin-aws-sigv4@npm:^3.6.1":
  version: 3.6.1
  resolution: "gremlin-aws-sigv4@npm:3.6.1"
  dependencies:
    aws4: ^1.11.0
    debug: ^4.3.4
    gremlin: ^3.6.1
  checksum: 51e574db25ecf7c046e257b30d2b43ef18ef09e7564558bc2b40452ac0db2ce85eee556074bd4cbe5d02f554e9c995264377498cfc78ff3b4713e0dd7bcd480d
  languageName: node
  linkType: hard

"gremlin@npm:3.6.2":
  version: 3.6.2
  resolution: "gremlin@npm:3.6.2"
  dependencies:
    ws: ^8.11.0
  checksum: c70c08ee108e9437afc81d6a945f66f5756c5dc09dd2772026d41bced952d5564c6f61e87066f3c807fb0f8c8af290ac399962c866f2b4695c0953d4e9113428
  languageName: node
  linkType: hard

"gremlin@npm:^3.6.1":
  version: 3.7.1
  resolution: "gremlin@npm:3.7.1"
  dependencies:
    ws: ^8.11.0
  checksum: e1a9cbf0bbcade9e66b9b9b5c3e51c15314e55fec5dba2dd8d3f309cff18b0ae4bffbfbf9e7c239054454b6060bc6aecb787e10af168f114722660d0ad049753
  languageName: node
  linkType: hard
"gremlin-aws-sigv4@npm:^3.6.1":
  version: 3.6.1
  resolution: "gremlin-aws-sigv4@npm:3.6.1"
  dependencies:
    aws4: ^1.11.0
    debug: ^4.3.4
    gremlin: ^3.6.1
  checksum: 51e574db25ecf7c046e257b30d2b43ef18ef09e7564558bc2b40452ac0db2ce85eee556074bd4cbe5d02f554e9c995264377498cfc78ff3b4713e0dd7bcd480d
  languageName: node
  linkType: hard

"gremlin@npm:3.6.2":
  version: 3.6.2
  resolution: "gremlin@npm:3.6.2"
  dependencies:
    ws: ^8.11.0
  checksum: c70c08ee108e9437afc81d6a945f66f5756c5dc09dd2772026d41bced952d5564c6f61e87066f3c807fb0f8c8af290ac399962c866f2b4695c0953d4e9113428
  languageName: node
  linkType: hard

"gremlin@npm:^3.6.1":
  version: 3.7.1
  resolution: "gremlin@npm:3.7.1"
  dependencies:
    ws: ^8.11.0
  checksum: e1a9cbf0bbcade9e66b9b9b5c3e51c15314e55fec5dba2dd8d3f309cff18b0ae4bffbfbf9e7c239054454b6060bc6aecb787e10af168f114722660d0ad049753
  languageName: node
  linkType: hard
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
The solution was to allow neptune to use the default mimetype; removing the mimetype header solved the issue
Jump to solution
Apache TinkerPop banner
Apache TinkerPopJoin
Apache TinkerPop is an open source graph computing framework and the home of the Gremlin graph query language.
1,376Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

using mergeV/E
Apache TinkerPopATApache TinkerPop / questions
4y ago
Multiple labels not working in mergeV() syntax for conditional inserts in AWS Neptune
Apache TinkerPopATApache TinkerPop / questions
3y ago
mergeV with onMerge when extra properties are unknown
Apache TinkerPopATApache TinkerPop / questions
15mo ago
Gremlin python MergeV update properties
Apache TinkerPopATApache TinkerPop / questions
13mo ago