share / share/sharedb

Object extensible error

Open
#480 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.5k
Forks
456
Avg merge
1d 5h
Merged PRs (30d)
5

Description

I honestly have no clue why this is happening. Here is how my stack works:

  1. The server creates a new doc, which is an empty list.
doc.create([], err => { if (err) console.log(err) })
  1. The client, after doing something, pushes to this list using a json0 op
doc.submitOp({ p: [0], li: "new-item" })
  1. The client gets an error
    TypeError: Cannot add property 0, object is not extensible at Array.splice in json0
  2. However, if I try again right away, it works for all subsequent ops.
  3. But other clients that are subscribed get the same error when the op gets broadcasted, so there seems to be something about the doc itself that is causing this.

This doesnt seem to happen when I create a doc on the client side and apply the same op to it. Is there anything special I need to do when creating the doc on the server side?

I have no clue where even to begin with this. Where in the ShareDB stack is Object.preventExtensions() being called? Does this have something to do with the websocket configuration?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the server-created empty-list flow described in the issue, comparing it with client-side creation. Trace the json0 operation through Array.splice and the broadcast to subscribed clients, then determine where the non-extensible object is introduced. Done means identifying the cause and the required server-side setup or configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.