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

fix for PublicApiRouter.js #4538

Closed
Macifier opened this issue Feb 1, 2018 · 14 comments
Closed

fix for PublicApiRouter.js #4538

Macifier opened this issue Feb 1, 2018 · 14 comments

Comments

@Macifier
Copy link

Macifier commented Feb 1, 2018

please modify 172 line of PublicApiRouter.js to
var params = _querystring2.default.stringify({ username: username, token: token, id: config.applicationId, error: err.message, app: config.appName });
because you are sending error object to choose_password params url so it is getting error as empty if you send err.message atleast we can display error on choose_password if it doesn't match password criteria

@dplewis
Copy link
Member

dplewis commented Feb 1, 2018

Do you mean this line https://github.com/parse-community/parse-server/blob/master/src/Routers/PublicAPIRouter.js#L159?

Do you want to submit a Pull Request?

@dplewis
Copy link
Member

dplewis commented Feb 1, 2018

@Macifier I put this up for grabs as I don't have time right now. @montymxb

@montymxb
Copy link
Contributor

montymxb commented Feb 1, 2018

So the only suggested change here is to the current line:

const params = qs.stringify({username: username, token: token, id: config.applicationId, error:err, app:config.appName});

by passing err.message instead of just err, just to make it clear.

@Macifier your issue is a need for customization right? Can you detail exactly what the existing problem is with the current passing of err? It is an object, but it should be encoded in the url string, or is just ending up completely blank as you mentioned?

@Macifier
Copy link
Author

Macifier commented Feb 1, 2018

it is ending up blank yes thats the line i have tested it locally but if we modify it to err.message then it works fine

@montymxb
Copy link
Contributor

montymxb commented Feb 1, 2018

I would be nice to keep the entire error object, or most of it. The error code would also be useful for example. It sounds like the object just needs to be prepped to stringify, surprised it isn't just automatically encoded with the rest of the params.

@Macifier do you think you could put something together to that extend? If you can put up a PR that would be quite helpful. I'm running around at the moment and won't be able to make the change anytime soon myself.

@paulovitin
Copy link
Contributor

paulovitin commented Feb 2, 2018

image

How?

@montymxb
Copy link
Contributor

@paulovitin I'm fantastic at getting back to notifications on time! 🤣 (extreme sarcasm...)

Sorry about the wait.
Something like JSON.stringify followed by urlencode could do the trick. Then we would be able to pass it a url encoded json string, allowing us to later decode to get the error object back.

@flovilmart
Copy link
Contributor

ping @paulovitin?

@paulovitin
Copy link
Contributor

@flovilmart 👀

@flovilmart
Copy link
Contributor

You mentioned you wanted to help :P that would be nice indeed!

@paulovitin
Copy link
Contributor

Sure... i will look until the end of this week.. Sorry haha

@flovilmart
Copy link
Contributor

No rush! it's been sitting there for a while and I came by it :)

@paulovitin
Copy link
Contributor

Guys, I believe this no make sense. The error object, is a Parse.Error, and it has a toString method. The qs.stringify makes the conversion correct, and you will receive the JSON object in the error querystring.

If you try:

var query = qs.stringify({ error: new Parse.Error(10, 'Test')});
// returns error%5Bmessage%5D=Teste&error%5Bcode%5D=10

var json = qs.parse(query);
// returns  { error: { message: 'Teste', code: '10' } }

If the problem is native errors, like new Error, I believe the problem is in another place.

@Macifier would you have any logs?

@dplewis
Copy link
Member

dplewis commented Apr 3, 2019

Closing via #5332

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

5 participants