🌲 stream closed prematurely

Hi :wave:

We’re experiencing some issues with @redwoodjs/realtime.

  /git/redwood-realtime-docker-error-repro  yarn rw dev                                                                                                                                                                       
web |   ➜  Local:   http://localhost:8910/
web |   ➜  Network: http://10.255.255.254:8910/
web |   ➜  Network: http://172.24.235.251:8910/
gen | Generating full TypeScript definitions and GraphQL schemas
gen | Done.
api | Building...
api | For help, see: https://nodejs.org/en/docs/inspector
api | Importing Server Functions... 
api | ...Done importing in 1 ms
api | GraphQL Yoga Server endpoint at graphql
api | GraphQL Yoga Server Health Check endpoint at graphql/health
api | GraphQL Yoga Server Readiness endpoint at graphql/readiness
api | 16:38:36 🌲 Server listening at http://[::]:8911
api | Server listening at http://[::]:8911/
api | 16:38:39 🌲 incoming request POST xxx /graphql
api | 16:38:39 πŸ› Parsing request to extract GraphQL parameters
api | 16:38:39 πŸ› Processing GraphQL Parameters
api | 16:38:39 πŸ› graphql-server GraphQL execution started: FindPosts
api | 16:38:39 πŸ› Processing GraphQL Parameters done.
api | 16:38:39 🌲 Starting a postgresql pool with 3 connections.
api | πŸ—’ Custom
api | {
api |   "prisma": {
api |     "clientVersion": "5.14.0"
api |   },
api |   "timestamp": "2024-08-06T14:38:39.508Z",
api |   "target": "quaint::pooled"
api | }
api | 16:38:44 🌲 stream closed prematurely
api | 16:38:45 🌲 incoming request POST xxx /graphql
api | 16:38:45 πŸ› Parsing request to extract GraphQL parameters
api | 16:38:45 πŸ› Processing GraphQL Parameters
api | 16:38:45 πŸ› graphql-server GraphQL execution started: FindPosts
api | 16:38:45 πŸ› Processing GraphQL Parameters done.
api | 16:38:47 🌲 stream closed prematurely
api | 16:38:47 🌲 incoming request POST xxx /graphql
api | 16:38:47 πŸ› Parsing request to extract GraphQL parameters
api | 16:38:47 πŸ› Processing GraphQL Parameters
api | 16:38:47 πŸ› graphql-server GraphQL execution started: EditPostById
api | 16:38:47 πŸ› Processing GraphQL Parameters done.
api | 16:38:49 🌲 stream closed prematurely
api | 16:38:49 🌲 incoming request POST xxx /graphql
api | 16:38:49 πŸ› Parsing request to extract GraphQL parameters
api | 16:38:49 πŸ› Processing GraphQL Parameters
api | 16:38:49 πŸ› graphql-server GraphQL execution started: FindPosts
api | 16:38:49 πŸ› Processing GraphQL Parameters done.
api | 16:38:50 🌲 stream closed prematurely
api | 16:38:50 🌲 incoming request POST xxx /graphql
api | 16:38:50 πŸ› Parsing request to extract GraphQL parameters
api | 16:38:50 πŸ› Processing GraphQL Parameters
api | 16:38:50 πŸ› graphql-server GraphQL execution started: EditPostById
api | 16:38:50 πŸ› Processing GraphQL Parameters done.
api | 16:38:51 🌲 stream closed prematurely

this error appears everytime the user navigates from a page with the @live directive and briefly on a page refresh with F5.

api | 16:38:49 🌲 stream closed prematurely

it’s an error from the apollo query and the cell failure is rendering it. (Although only very shortly before unmounting it.

export const Failure = ({ error }: CellFailureProps<FindPosts>) => (
  <div className="rw-cell-error">{error?.message}</div>
)

I’ve checked previous repositories for the same error and it was reproducible with this one:

which was used for a previous thread.

The message doesn’t appear if you remove the @live directive from the gql queries. So I’m unsure if this is related to this issue

Which reportedly didn’t involve any realtime features.

Help appreciated :raised_hands:

@xmaxcooking do you see this problem specifically when using docker compose?

hi, thanks for asking. to clarify: the docker part of the repository is unrelated. I linked that repository because it includes a full realtime liveQuery example.

we can see the error in a local dev env when running yarn rw dev.

This is intentional behaviour from Fastify. See this comment for the background on this decision: Fix double logging + reduced log level for streams by thomheymann Β· Pull Request #2190 Β· fastify/fastify Β· GitHub