Skip to content

Issue upgrading from v5 to v6 due to how parse objects are no longer cast to pointers in queries & save methods in cloud code triggers #9831

@isokosan

Description

@isokosan

Issue Description

As I've outlined here in the community forum, I'm unable to upgrade from version 5.x.x due to a change of how parse object classes / subclasses used to be cast automatically to a pointer in Parse queries and set methods within Cloud Code triggers.

Below is an example with querying but the same issue happens when setting a pointer field on objects in a cloud code trigger functions.

If this is a bug I'm willing to add a hefty bounty to add backwards compatibility support. If its something to do with missing new options such as the maintenanceKey being required, or some other option not outlined in the release notes, I'd love to be enlightened. Thanks!

Steps to reproduce

const Author = Parse.Object.extend('Author')
const Post = Parse.Object.extend('Post')

Parse.Cloud.beforeSave(Author, async ({ object: author }) => {
  if (!author.isNew()) {
    const postsCount = await new Parse.Query('Post')
      .equalTo('author', author)
      .count({ useMasterKey: true })
    author.set('postsCount', postsCount)
  }
})

async function test () {
  const author = new Author({ name: 'Test' })
  await author.save(null, { useMasterKey: true })

  const post = new Post({ title: 'Test Post', author: author })
  await post.save(null, { useMasterKey: true })

  // works in v5.6.0 - errors in v6.0.0
  await author.save(null, { useMasterKey: true })
}

Actual Outcome

In this simple test, unless using account.toPointer() in the equalTo clause, the beforeSave function errors with:
error: Uncaught internal server error: Postgres doesn't support this query type yet {"className":"Author","_objCount":3,"id":"0CNmSo2Cso"}

Expected Outcome

Expected the author object to be cast to a pointer and the query to work as usual.

Environment

node:18.20.8

Server

  • Parse Server version: 6.0.0
  • Operating system: node:18.20.8 docker image
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local on docker

Database

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

Client
In this example I'm not using a client SDK

Logs

error: Uncaught internal server error: Postgres doesn't support this query type yet {"className":"Author","_objCount":3,"id":"0CNmSo2Cso"}

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