Creating/Testing FQL Queries with the Identity Function

My goal is to create a UDF for returning information about the logged in user. I am attempting to create a UDF of the form:


Lambda is an expression invoking Get which requires a reference and returns the document I want. Identity returns a reference to the logged in user. In practice, this should work.

The problem is, in the FQL shell or when I’m trying to add this UDF function, that the identity function returns the error Authentication does not contain an identity.

This error prevents me from saving the function and consequently also blocks me from getting the GQL query working in the app that has the proper authentication token configured.

Something like that is in the works! Don’t know how soon that will be. But it sure will make it easier.

Make sure you still give the Lambda in the UDF body an argument. There’s no reason it shouldn’t work to update the function in the shell. Since the body property is wrapped in a Query function, it does not get executed, so Identity() does not try to get run from the dashboard.

  name: "someUDF",
  body: Query(
    Lambda([], Get(Identity())) // note the first argument of `Lambda`

Ah thanks for the heads up. I’m working with something relatively simply at the moment, but that would do wonders if I start looking into testing RBAC.

Awesome that worked. Since we can’t impersonate identity yet, Query is exactly what we need to defer until I run this as a UDF (via GQL) with a token that has an identity! Thank you.