Skip to content

Parse.User.save fails with RangeError when saving a field value with an object that circularly references the user #2707

@mdarens

Description

@mdarens

New Issue Checklist

Issue Description

When saving a user from the SDK, if an attribute points back to the user, stringify will fail with a RangeError: Invalid string length

Steps to reproduce

  1. Register a subclass on Parse.Object called Store with a field that points to the User class e.g. manager
  2. Extend the User class to have a store field that points to Store
  3. Create some users
  4. Create a Store with its manager field pointing to a User
  5. Attempt to save a User with its store field pointing to that store
  6. Observe the error

Actual Outcome

Uncaught exception thrown trying to save user

Expected Outcome

Circular pointer serializes automatically

Environment

Server

  • Parse Server version: 8.2.0
  • Operating system: alpine linux in docker (node:18-alpine3.21)
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Google Cloud

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 7.0.22
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB Atlas

Client

  • Parse JS SDK version: 6.1.1

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions