Hi,
I’m trying to perform a simple query via the server program and getting an error.
Below is the function that performs the query:
async findUserByAuthId(auth_id: string): Promise<User | null> {
const query = fql`User.all().where(.auth_id == "${ auth_id }")`; // this doesn't work
// const query = fql`User.all().where(.auth_id == "gd4AYvoAkTa9NpYoUq5kBhsvL1q1")`; // this works
const result = await this.faunaClient.query<User>(query);
return result.data;
}
And this is the error I get:
What’s strange is that it looks like variable interpolation is causing the issue.
If I remove the interpolation and replace the variable with the value it holds (the commented line in the screenshot), then it works…
I printed the variable to make sure that it is holding the correct value and is not null or undefined.
Thanks in advance!