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

Query fails because of "pointer to incorrect className" #3404

Closed
designunion opened this issue Jan 19, 2017 · 4 comments
Closed

Query fails because of "pointer to incorrect className" #3404

designunion opened this issue Jan 19, 2017 · 4 comments

Comments

@designunion
Copy link

designunion commented Jan 19, 2017

Somehow I have saved pointers to different classes (user and a custom class) in the same column. The query fails because the mongo transform adapter (MongoTransform.js) throws in error versus logging and dropping the column. This occurs whether or not I include the column. It also occurs whether or not I get or find.

When "found a pointer column not in the schema" and when "found a pointer in a non-pointer column" occurs the column is dropped. These pointer problems seem to be on par with "pointer to incorrect className". These issues seem like they should be treated the same.

In the mongo transform adapter I have done the following and not noticed any issues:
Commented out the throw:

//  if (objData[0] !== schema.fields[newKey].targetClass) {
//    throw 'pointer to incorrect className';
//  }

Replaced the throw with

if (objData[0] !== schema.fields[newKey].targetClass) {
  _logger2.default.info('transform.js', 'Found a pointer to incorrect className, dropping it.', className,   key);
  break;
}

Using the above options I am able to loop through and update (or unset) the offending column data but it seems that the server should handle this more gracefully then throwing an error. Primarily because we now have multiple ways to access and damage our data. We use parse because it is so easy to implement but now we have tools to create more issues.

The offending data was last updated in April 2015. I believe I created the issue by deleting the column in the dashboard and then reusing the same column name but with a pointer to a custom class versus the user class. The column data should have been deleted but maybe not.

Parse hosted does not throw an error. In the dashboard it will even show the pointer id to the incorrect class. Clicking through to the pointer will simply show zero results.

Steps to reproduce

Run query on class that has column that contains correct and incorrect pointers. Pointers should have a class name of "Account" but older data contains class name "_User".

Good Data

 "updatedBy": {
“__type”: "Pointer", 
“className”: "Account", 
“objectId”: "S6XXzdhfAy"
}

Bad Data

"updatedBy": {
"__type": "Pointer",
"className": "_User",
"objectId": "S6XXzdhfAy"
}

Expected Results

Multiple results. Ideally the offending column is not even dropped.

Actual Outcome

Error because "pointer to incorrect className", see log info below. Event – ParseError {code: 1, message: undefined}.

Environment Setup

  • Server

    • parse-server version: 2.3.2
    • Node: 6.9.4.
    • Parse JS SDK: 1.9.2
    • Operating System: OSX 10.12.2
    • Hardware: MacBook Pro
    • Localhost or remote server? Localhost
  • Database

    • MongoDB version: Unknown
    • Storage engine: RocksDb
    • Hardware: Unknown
    • Localhost or remote server? NodeChef

CURL

This curl works in parse hosted dashboard whether or not the column data pointer is to the correct class. This will not work via the local host dashboard when the data pointer is to the incorrect class.

curl -X GET
-H "X-Parse-Application-Id: Qe7OgKeblL8tZWRSr45UDRQhp9wkuN37VCabgwey"
-H "X-Parse-Master-Key: cjHVcef0CeJNLNwyfHmG4JgdIp846i0zxyOsHHFv"
-G
--data-urlencode "where={"objectId":"p4cGpGJ7U3"}"
https://api.parse.com/1/classes/Event

Logs/Trace

verbose: REQUEST for [GET] /parse/classes/Event: {
"where": {},
"limit": 10
} method=GET, url=/parse/classes/Event, host=localhost:1337, pragma=no-cache, accept=/, accept-language=en-us, accept-encoding=gzip, deflate, cache-control=no-cache, content-type=text/plain, origin=http://localhost:1337, user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/604.1.2 (KHTML, like Gecko) Version/10.2 Safari/604.1.2, referer=http://localhost:1337/main, content-length=236, connection=keep-alive, cookie=pnctest=1, , limit=10
error: Error generating response. 'pointer to incorrect className' error=pointer to incorrect className
error: Uncaught internal server error. pointer to incorrect className
pointer to incorrect className

Suggestion

Potentially allow the enabling of "unsafe" queries in development mode so that the data can be returned and easily inspected to find the errors. I had a similar issue with invalid dates last week. I am not sure if there is a good reason to throw this error but if there is an error of this type and you do not have access to the adapter you are essentially out of luck if you need to fix the data. If the problem requires a patch and you are using a service such as Sashido or Nodechef you may need to wait until they have time to implement a patch. If you have a live product this could be crippling to your users.

@stale
Copy link

stale bot commented Sep 18, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 18, 2018
@stale stale bot closed this as completed Sep 25, 2018
@yingmu52
Copy link

any news on this issue??

e on port 1337
error: Error generating response. ParseError { code: 1, message: 'pointer to incorrect className' } code=1, message=pointer to incorrect className
error: pointer to incorrect className code=1, message=pointer to incorrect className
error: Error generating response. ParseError { code: 1, message: 'pointer to incorrect className' } code=1, message=pointer to incorrect className
error: pointer to incorrect className code=1, message=pointer to incorrect className

@designunion
Copy link
Author

I cannot remember how I resolved/fixed this issue.

@shiva-p17
Copy link

I cannot remember how I resolved/fixed this issue.

Who asked ??!!!

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

3 participants