Skip to content

query.get is using find which creates issues with BeforeFind #5006

Closed
@mullwaden

Description

@mullwaden

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.

  • When I run the following command in the front-end (new Parse.Query('BusinessUnit')).get('HlNbtoSUiR') the parse-js-sdk creates a POST request to http://localhost:1337/parse/classes/BusinessUnit.
  • This triggers handleFind (not handleGet) in ClassesRouter.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() in rest.js which in turn calls the beforeFind trigger with isGet set to false

Relevant 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)

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