fauna/fauna-js

Does not work with Fauna Dev, unknown format error

jagaapple opened this issue · 3 comments

I attempted to connect to Fauna locally (using Fauna Dev) with fauna-js instead of faunadb-js, but encountered a format error.

Current Behavior

# Shell
% nc -vz localhost 8443
Connection to localhost port 8443 [tcp/pcsync-https] succeeded!
// main.ts
import { Client, endpoints, fql } from "fauna";

const client = new Client({ secret: "secret", endpoint: endpoints.local });
const query = fql`123`;
await client.query(query);

The following error has occurred.

ProtocolError: Response is in an unkown format: [object Object]

To begin with, does fauna-js support Fauna Dev? If there are any options I might have missed in the configuration, please let me know.

P.S. It seems that the spelling of unknown in the error message is incorrect.

message: `Response is in an unkown format: ${e.body}`,

macmv commented

Fauna dev should be supported.

What version of the container do you have?

docker image ls | grep faunadb
# output should contain something recentish, anything more than a few months old might cause problems

And can you curl the container?

curl -X POST -H "Authorization: Bearer secret" http://127.0.0.1:8443/query/1 -d '{"query":"2 + 3"}'
# should respond with something like
{"data":5,"summary":"","txn_ts":1693600362991000,"stats":{"compute_ops":1,"read_ops":0,"write_ops":0,"query_time_ms":2,"contention_retries":0,"storage_bytes_read":0,"storage_bytes_write":0,"rate_limits_hit":[]},"schema_version":0}

It works well, thank you 😄
I attempted to update the Docker image, but it didn't update properly, perhaps due to caching issues...
Sorry for raising such a basic issue!

macmv commented

No problem, I'm glad you got it sorted