Skip to content

Can't access request params #370

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

Closed
mikepaggi opened this issue Feb 12, 2016 · 8 comments
Closed

Can't access request params #370

mikepaggi opened this issue Feb 12, 2016 · 8 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@mikepaggi
Copy link

I can't seem to access the request params as it appears to be displaying as undefined.

I'm posting to a cloud function with populating a parameter of "q".

I post to this URL and just have it print the request.params.q as part of the json response. I've tried with my personal project and also the parse-server-example and i get the same issue. (the url below is actually to the parse-server-example)

http://localhost:1337/parse/functions/hello?q=test

Is this an error due to Parse Server (though it's express.js middleware and just passing existing request and response) or am i doing this wrong? I can't find help through stack overflow so i'm coming here...

@drew-gross
Copy link
Contributor

Have you tried posting your params in the request body instead of the url?

@mikepaggi
Copy link
Author

No I have not. What would it look like In terms of how I'm sending it?

Also this used to work when it was on Parse.com before (sorry should of mentioned that) so I'm not sure why it stopped working.

@mikepaggi
Copy link
Author

Also looking on the example on the page listed below it looks like I should be able to access the request.params json object

https://parse.com/docs/cloudcode/guide#cloud-code-cloud-functions

@drew-gross drew-gross added the type:bug Impaired feature or lacking behavior that is likely assumed label Feb 12, 2016
@drew-gross
Copy link
Contributor

You can see some example CURLs in our REST guide that use a body in a POST request: https://parse.com/docs/rest/guide#cloud-code however if this used to work in parse.com then it's a bug and we should fix it.

@mikepaggi
Copy link
Author

I will give that a try for at least the moment but yes it used to work.

Also in the parse documentation on that same page you will see the following.

In general, two arguments will be passed into cloud functions:

request - The request object contains information about the request. The following fields are set:
params - The parameters object sent to the function by the client.
user - The Parse.User that is making the request. This will not be set if there was no logged-in user.

@mikepaggi
Copy link
Author

posting to the body like that seemed to work for now at least thank you. At least some point it would be good to fix this but seems like i can just use this now for at least testing purposes when I use postman.

@flovilmart
Copy link
Contributor

@drew-gross I'll take up that one. Can you assign to me?

@gfosco
Copy link
Contributor

gfosco commented Feb 16, 2016

Merged in #439 which should fix this, will release it as 2.0.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

4 participants