Skip to content

"No response error" UnhandledPromiseRejection with createWsServer crashes nodejs server. #194

@aurmartin

Description

@aurmartin

Describe the bug

I am having UnhandledPromiseRejection errors on the server when using createWsServer with persistence server-side. The error crashes the whole node process:

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "No response from TQjiy13/0Fkji6fv3Zk3tA== to G0NvmWywJSsz7C-e, 4".
    at throwUnhandledRejectionsMode (node:internal/process/promises:389:7)
    at processPromiseRejections (node:internal/process/promises:470:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:32) {
  code: 'ERR_UNHANDLED_REJECTION'
}

I can reproduce it using the same code as the Todo collaboration demo, see the linked repository.

This error occurs frequently, at random moments.

I can reproduce it systematically when I open the app in one browser, then in another browser and then close the second browser.

The error also appear client-side:

image

Your Example Website or App

https://github.com/aurmartin/tinybase-bug-report

Steps to Reproduce the Bug or Issue

  1. Clone the repo https://github.com/aurmartin/tinybase-bug-report
  2. Start the react app and the server (see the README.md)
  3. Open the react app, populate the store.
  4. Open the react app in another browser, quickly refresh after the start.

Expected behavior

The server and the application should keep working when a client close the connection.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Brave v1.71.121
  • Tinybase: v5.3.7
  • Node.js: v20.18.0

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions