So, I have a project based on Fauna deployed to the cloud, but development is maid against local Docker Fauna, which is very convenient for TDD. Today I tried to implement document stream support for chat and have a problem - it seems stream is established, but no ‘start’, ‘snapshot’ or ‘version’ events coming. At the same time, if I pass a non-existent collection name or document id in Ref passed to client.stream.document(…), it fires ‘error’ event. So I am a bit confused - will be very grateful if someone can help.
The document stream helper only provides the snapshot and version (plus error) events, and it requires the target document reference to exist.
We don’t currently provide any examples that avoid using the document helper, but there is some useful commentary in the driver source code that you might find helpful: faunadb-js/Client.js at main · fauna/faunadb-js · GitHub
Hi, Ewan. Thanks, but I am using document helper with no events coming from stream on local Docker-based Fauna. Today I deployed code to the cloud and cloud Fauna streaming is working.
So question is “Does Docker-based Fauna on localhost fully support streaming?”. It seems for me that it’s not the case. Will be very grateful for some comment on this topic from Fauna team. Thanks for great product!
The current Fauna Dev Docker image does support document streaming, although it remains an “early access” feature.
The way that the Docker image is configured (internally) might limit the number of active streams to 6-7 concurrently. If you try to use more streams at the same time, you might find that streaming appears to stop working. We have only seen a few reports of this.
Hi! Thank you for the answer. I followed your instructions, provided custom config so I can
check it is being used seeing Cluster name: faunastreams in the logs because of the line cluster_name: faunastreams in custom config file instead of default “fauna”.
For sure I provided stream_enable_api: true in same config file.
Faunadb was so kind that even merged my config with default, giving me this at the end:
But still no luck with local streams. They worked like a charm in production, though! So maybe I still missed something? It will be definitely cool to be able to test streams locally, because I can initiate object updates in Cypress test with custom command and then check UI changes.
I should also mention that I don’t have permissions to use gcr.io/faunadb-cloud/faunadb/enterprise/nightly:latest suggested in Github issue and use standard Docker Hub as mentioned in the docs Fauna Dev | Fauna Documentation
I had a hope, that problem can be in old fauna docker image, so I upgraded to the latest version.
In Dockerfile it has this line: LABEL faunadb.version=21.08.00 faunadb.package=21.08.00-0
But unfortunately, no luck with local streams support. Same code runs in production and in the tests, production works like a charm and no ‘start’, ‘snapshot’ and ‘version’ events from local Docker Fauna…