-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
query.get is using find which creates issues with BeforeFind #5006
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
Comments
Can you provide the logs when running with VERBOSELY=1 p’ease? |
Sure thing, so when i run the following command It prints:
in beforeFind for BusinessUnit I get the following parameters:
|
Made a little workaround in my beforeFind which works but doesnt feel quite right:
|
Closing as behaving as expected. The isGet denotes if using the endpoint with objectId, not a query on the objectId. Please update your code accordingly |
Hmm ok, how would I write it correctly in the front-end? Seems strange to me that .get is not isGet |
Use Parse.Object() ‘s [fetch] |
I see, maybe isFetch would be a better name - anyhow easy to work around, just confusing |
yeah maybe. But we won't consider this change at the moment. |
Issue Description
I am having issues with the isGet parameter in the beforeFind trigger. While my query is definitely a .get isGet does not seem to be set correctly.
(new Parse.Query('BusinessUnit')).get('HlNbtoSUiR')
the parse-js-sdk creates a POST request tohttp://localhost:1337/parse/classes/BusinessUnit
.handleFind
(nothandleGet
) inClassesRouter.js
in the back-end. This is likely because handleGet expects a route with the following format/classes/:className/:objectId
but as the get in the frontend uses .first it ends up calling/classes/:className
ClassesRouter.js
then triggers find() inrest.js
which in turn calls thebeforeFind
trigger withisGet
set to falseRelevant files:
https://github.com/parse-community/Parse-SDK-JS/blob/master/src/ParseQuery.js
https://github.com/parse-community/parse-server/blob/master/src/Routers/ClassesRouter.js
https://github.com/parse-community/parse-server/blob/master/src/rest.js
Steps to reproduce
Run any query.get command and look at the network tab
Expected Results
A .get query in the frontend GETs on
/classes/:className/:objectId
Actual Outcome
A .get query in the frontend POSTs on
/classes/:className
(the POST vs GET bit is probably fine, but the route seems off)
The text was updated successfully, but these errors were encountered: