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

http server response cannot be used in promises #5651

Closed
ta3pks opened this issue Mar 11, 2016 · 7 comments
Closed

http server response cannot be used in promises #5651

ta3pks opened this issue Mar 11, 2016 · 7 comments
Labels
promises Issues and PRs related to ECMAScript promises.

Comments

@ta3pks
Copy link

ta3pks commented Mar 11, 2016

https://gist.github.com/anonymous/1b48c89fb63d7cc02021
http://i.imgur.com/r6DYhH2.png

i have the code i pasted above when that user.login function runs server does nothing but waiting and when connection got timeout or terminated by user script logs the results to console i cant end the response those previous res.fails work fine just this part makes issue and unless req is terminated it does not even step inside the then block

the demo
test

@mscdex mscdex added the http Issues or PRs related to the http subsystem. label Mar 11, 2016
@mscdex
Copy link
Contributor

mscdex commented Mar 11, 2016

This doesn't seem like a node issue to me.

One thing that sticks out in the code you've provided is that you're not handling the case when data.status != "sucess". Also, might the issue be that data.status === 'success'?

@ta3pks
Copy link
Author

ta3pks commented Mar 11, 2016

@mscdex controls does not matter because program is not stepping inside the block and actually i dont even need to worry about success because its just because of habit i have a status there in case of failure my login function changes the promise status into rejected which means the catch block will handle that just the iissue the login function never returns something while request is on the process and when it timesout programs returning the expected value and loging to the console

@ta3pks
Copy link
Author

ta3pks commented Mar 11, 2016

test

heres the demo showig the issue its nothing about wrong controls etc

@ta3pks
Copy link
Author

ta3pks commented Mar 11, 2016

so i guess this is a real bug in nodejs or particularly promises i had a similar issue with events before the promise worked only once and when the eventHandler triggered again it aint do anything i solved that by using callback approach but in this case it means me changing entire class is there a common problem with promise implementation in nodejs ?

@ta3pks
Copy link
Author

ta3pks commented Mar 12, 2016

ranisalt/node-argon2#37 (comment)

it turns out that the bug is about argon2 nodejs package so nothing to do with nodejs

@ta3pks ta3pks closed this as completed Mar 12, 2016
@vkurchatkin vkurchatkin added invalid Issues and PRs that are invalid. promises Issues and PRs related to ECMAScript promises. and removed http Issues or PRs related to the http subsystem. invalid Issues and PRs that are invalid. labels Mar 12, 2016
@vkurchatkin
Copy link
Contributor

I'll reopen it for now, it might be related with the way we handle microtask queue: ranisalt/node-argon2#25

@vkurchatkin vkurchatkin reopened this Mar 12, 2016
@vkurchatkin
Copy link
Contributor

Closing in favour of #5691

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
promises Issues and PRs related to ECMAScript promises.
Projects
None yet
Development

No branches or pull requests

3 participants