Search code examples
gremlingremlin-serveramazon-neptunegremlinjs

Could not locate method: NeptuneGraphTraversal.values()


I'm getting this error Could not locate method: NeptuneGraphTraversal.values() when running a query using gremlin for aws neptune. The specific query is this:

import { process } from 'gremlin';

const { statics, t } = process;

    function getUsers() {
        return await this.query(g =>
            g
                .V()
                .match(
                    statics
                        .as('me')
                        .V(this.id)
                        // .has('user', t.id, this.id)
                        .fold()
                        .coalesce(
                            statics.unfold(),
                            statics.addV('user').property(t.id, this.id)
                        ),
                    statics.as('me').out('followed').out('followed').as('x'),
                    statics.as('x').not(statics.has(t.id, this.id)),
                    statics
                        .as('x')
                        .out('followed')
                        .has(t.id, this.id)
                        .count()
                        .is(0),
                    statics.as('x').in_('skip').has(t.id, this.id).count().is(0)
                )
                .select('x')
                .values(t.id)
                .dedup()
                .sample(3)
                .toList()
        );
    }

The error message suggests that neptune's GraphTraversal doesn't implement the values method, but I've reviewed the implementation differences and there's no mention of that. What could be the problem? What alternatives can I consider?


Solution

  • This is likely due to the fact that you're using the values() step to extract the ID. values() takes a string of a property key. More likely what you need is the id() step.