Hi,
As my first test project I decided to make a simple app: have a database of a movie watchlist and allow users to search an imdb id and return some information about that movie from the database.
This query works in my javascript code (get by document id):
const result = await faunaClient.query(q.Get(q.Ref(q.Collection(params.type), params.id)))
This query works on the fql shell:
Call(Function("movie_by_id"), "tt0133093")
This query does NOT work in the javascript:
const result = await faunaClient.query(q.Call(q.Function(“movie_by_id”),“tt0133093”))
I get: "“error”:“StatusError: BadRequest: invalid argument”
Here is the UDF:
Query(
Lambda(
["ID"],
Let(
{ movie: Select(["data"], Get(Match(Index("test"), Var("ID")))) },
Var("movie")
)
)
)