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

/GET /users/me triggers handler for /GET /users/:objectId as well #2933

Closed
zaach opened this issue Oct 25, 2016 · 1 comment
Closed

/GET /users/me triggers handler for /GET /users/:objectId as well #2933

zaach opened this issue Oct 25, 2016 · 1 comment

Comments

@zaach
Copy link

zaach commented Oct 25, 2016

/GET /users/me matches two routes because of the overlap with /GET /users/:objectId. The second handler is called with the objectId set to me, which fails with a "Object not found." error.

Steps to reproduce

  1. Turn on verbose logging.
  2. create session
  3. curl -X GET /users/me (with necessary headers)

Expected Results

There should only be one request logged, and no "Object not found." error.

Actual Outcome

Two separate logs for verbose: REQUEST for [GET] /parse/1/users/me, an "Object not found." ParseError, and an express.js error Error: Can't set headers after they are sent.

Environment Setup

parse-server 2.2.23 locally and on AWS

Logs/Trace

2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344 error: Error generating response. ParseError { code: 101, message: 'Object not found.' } code=101, message=Object not found.
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344 Tue, 25 Oct 2016 06:25:52 GMT express:router handleParseErrors  : /parse/1/users/me
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at next (/app/node_modules/express/lib/router/index.js:271:10)
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344 Error: Can't set headers after they are sent.
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:356:11)
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at ServerResponse.header (/app/node_modules/express/lib/response.js:719:10)
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at ServerResponse.send (/app/node_modules/express/lib/response.js:164:12)
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at ServerResponse.json (/app/node_modules/express/lib/response.js:250:15)
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at handleParseErrors (/app/node_modules/parse-server/lib/middlewares.js:248:9)
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at Layer.handle_error (/app/node_modules/express/lib/router/layer.js:71:5)
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at /app/node_modules/express/lib/router/index.js:280:7
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at Function.process_params (/app/node_modules/express/lib/router/index.js:330:12)
2016-10-25T06:25:52Z parse:RTWTPIYXJKL/4d7370c0c344     at trim_prefix (/app/node_modules/express/lib/router/index.js:310:13)
zaach added a commit to zaach/parse-server that referenced this issue Oct 25, 2016
@zaach
Copy link
Author

zaach commented Oct 25, 2016

(This was an issue with an older version.)

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

1 participant