No form/function found, or invalid argument keys: { lambda, expr }

Trying to create a UDF in node with:

function GetItems(client) {
    q.Map(
      Paginate(
        Lambda(['score', 'authorRef'], Match(Index('by_author'), Var('authorRef')))  
      ),
      // the created time has served its purpose for sorting.
      Lambda(['createdtime', 'ref'], Var('ref'))
    )
  )
  return FQLStatement
}

is causing:

No form/function found, or invalid argument keys: { lambda, expr }.

wondering what I am doing wrong? Thank you

Paginate takes an array or set, not a Lambda.

Try this instead:

function GetItems() {
    const FQLStatement = q.Map(
      Paginate(Match(Index('by_author'), Var('authorRef'))),
      // the created time has served its purpose for sorting.
      Lambda(['createdtime', 'ref'], Var('ref'))
    )
  )
  return FQLStatement
}
1 Like