faunadb-js
faunadb-js copied to clipboard
queryTimeout is broken
When using the queryTimeout option, the promise returned by faunaClient.query(xxx, { queryTimeout: 30 }) never resolves.
This was my code in a Cloudflare Worker. The promise would simply never resolve.
const projectRef = q.Ref(q.Collection("Projects"), options.projectId);
await faunaClient
.query<string | null>(
q.If(
q.Exists(projectRef),
q.Select(["data", "flagsRevision"], q.Get(projectRef)),
null
),
{ queryTimeout: 10 }
)
.catch((error) => {
console.error("fauna error");
console.error(error);
return null;
})
As a workaround, I used the signal option instead of the queryTimeout.