Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When i want to update some stuff but got error #4342

Closed
IOsonoTAN opened this issue Nov 13, 2017 · 2 comments
Closed

When i want to update some stuff but got error #4342

IOsonoTAN opened this issue Nov 13, 2017 · 2 comments

Comments

@IOsonoTAN
Copy link

IOsonoTAN commented Nov 13, 2017

Issue Description

I have a client they're using a [email protected] in frontend and connect with [email protected] so i have to fix some problem for them, i tried to create a new object, get detail or delete some object that all works fine but i can't update any object, it always return error code 101 and message is "Object not found."

Steps to reproduce

  1. I've mongoDB collection named "Article" and this is a schema of this collection.
{
  "_id": "OjsasOSExy",
  "name": "article one",
  "detail": "article one detail",
  "rank": 0,
  "_created_at": "2017-11-13T16:45:00.000+0700",
  "_updated_at": "2017-11-13T16:45:00.000+0700"
},
{
  "_id": "ikDqSQ0pVp",
  "name": "article two",
  "detail": "article two detail",
  "rank": 1,
  "_created_at": "2017-11-13T16:45:00.000+0700",
  "_updated_at": "2017-11-13T16:45:00.000+0700"
}
  1. I want to re-order of rank field.
const Article = Parse.Object.extend('Article')

new Promise((resolve, reject) => {
  const articles = articles.map((article, index) => {
    return new Article({
      objectId: article.objectId,
      rank: index
    })
  })

  Parse.Object.saveAll(articles, {
    success: (articles) => {
      resolve(articles)
    },
    error: (e) => {
      reject(e)
    }
  })
})

Expected Results

The data update success with new rank.

Actual Outcome

I got error from ParseServer.

verbose: {
  "response": [
    {
      "error": {
        "code": 101,
        "error": "Object not found."
      }
    },
    {
      "error": {
        "code": 101,
        "error": "Object not found."
      }
    }
  ]
}

Environment Setup

  • Server

    • parse-server version: 2.2.14
    • Operating System: MacOS (10.12.5)
    • Hardware: Macbook Pro 2017
    • Localhost or remote server: Localhost
  • Database

    • MongoDB version: v3.4.6
    • Storage engine: -
    • Hardware: -
    • Localhost or remote server: Localhost

Thank you

@montymxb
Copy link
Contributor

Seems like the object you're updating doesn't match what's on the server. As in, for the objectId you're setting by hand, the object cannot be found server-side. To confirm this you can try simply querying for your objects directly, making a change and saving them. If that succeeds then it's likely the ids you're setting here manually are incorrect. Otherwise let us know, as it you might have another error.

@IOsonoTAN
Copy link
Author

@montymxb I just found how to resolve this problem.

It all about role and users, i tried to create a new to be admin but i forget to create relation in role table, it make me can't update or create a new object.

And that error message doesn't make sense it must error about permission something error.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants