Closed jim-y closed 8 years ago
This is really odd. The same function works with co but not koa. The behavior when it doesn't work is also interesting: it will print the salt, when I ctrl+c curl it prints the hash, and then when I execute curl again it finishes and prints the salt again (continuing the loop). I've even tried requiring koa in my co example, but it still works.
With co (works): https://gist.github.com/PlasmaPower/fb3c12744d9bd35874b2
With koa (doesn't work): https://gist.github.com/PlasmaPower/e7c4e55c95f4bd7190d6
With koa and custom co wrapper (doesn't work): https://gist.github.com/PlasmaPower/fc4dea9bc7f3e5158fa2
With koa and custom co wrapper in separate call chain (doesn't work): https://gist.github.com/PlasmaPower/7a8c41efbdcc07a86fea
With koa and promises with experimental (doesn't work): https://gist.github.com/PlasmaPower/3ddd5f98f7e7cbfd2874
With koa@next and promises (doesn't work): https://gist.github.com/PlasmaPower/dfe0786ed601a4f1c3cc
I figured it out - argon doesn't work correctly when called from a require('http')
server, which is what practically every server uses. Here's a broken example without koa: https://gist.github.com/PlasmaPower/f3cc2c06875eee760d81
I'd say close this issue, and change the title of the issue at argon2
.
looks like some crazy side effect. since it was shown this doesn't have anything to do with koa itself, closing.
Just for documentation, it was fixed a while ago, and the issue were how v8 promises work internally.
Hi!
Probably it's not the right place to report my problem, but I think it should be written down here too (also I will report it at node-argon2).
I tried to use argon2 in my koa application but I couldn't make it work because if I use node-argon2's hash method within a koa controller I get a strange timeout. I couldn't find out why this happens hence the question. I've created some dead simple examples to show the issue.
I tried to verify if this thing really only happens with koa so I modified the example two times
Example 1
Removed yield from the koa controller and used "plain" promises to create the hash, meaning I won't return a promise from the function call
It seems that koa fails to call an additional .next() on the iterator?!
Example 2
koa omitted
Any thoughts about this?
tags: koa, argon2, node, timeout, promise, yield