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
nock and popsicle not working nicely together #2005
Comments
And another one:
And then, after several more calls are completed, we get this error thrown:
I have masked hostnames and IP addresses but the IP address in question is what validhostname.com resolves to in our environment. It's just not accepting connections right now. Which is one reason we're nocking it! It would appear these are the same problem - this is just a case where the hostname resolves, so it moves on to connecting whereas the one in the OP is one that doesn't resolve. Either way, it seems nock isn't stopping popsicle from trying to do everything itself. And we use .persist() everywhere so it's not a second call not being nocked. |
@KrayzeeKev thanks for the ticket. I haven't used Popsicle before and I think you're the first to bring up this issue. Looking at the debug output, Nock seems to be successfully intercepting the requests and returning your desired fake responses. Thanks for the RunKit. The fact that I can swap out Minor call out; you shouldn't be putting any of the path in the string for the first arg to |
Thanks Matt - I've delved into the popsicle stuff quite a bit but it very quickly becomes so abstracted that it's very difficult to follow. But it is on my list. Anybody else who might want to try will have our eternal gratitude. We don't use popsicle directly. We use it via client-oauth2 so we don't have a choice in the matter. I'd happily replace it with Axios or got (just working through eliminating request because it's dead and has security holes). But that's not something we can control. Thanks for the call out about the first arg. I'll do a sweep of our tests and refactor them a bit and inform the team. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We try to do our best, but nock is maintained by volunteers and there is only so much we can do at a time. Thank you for your contributions. |
Is there any movement on this? |
Would suggest posting in popsicle :) |
What is the expected behavior?
Context: Sitting behind firewall - no external DNS possible.
nock'ed URL should return nock'ed response.
What is the actual behavior?
nock returns THEN a dns exception is raised
Possible solution
Is nock returning before it's done? Or is it popsicle being too clever for its own good.
How to reproduce the issue
Runkit: Bug Demo
Does the bug have a test case?
This code:
Runs and then, AFTER, the fetch/get is complete, it gets a DNS error. And SOMETIMES nock debug entries are emitted AFTER the fetch/get is complete:
NOTE1 - the number of timeout loops varies.
NOTE2 - There are two nock.playback_interceptor debug lines output AFTER the fetch is complete. This could be async debugging? Or is it nock returning too early? Or not awaiting a promise?
NOTE3 - the two late debug lines don't always happen - if the DNS failure happens quickly then it fails immediately after "Before timeout 1".
Is this a popsicle problem? Or a nock problem?
Versions
The text was updated successfully, but these errors were encountered: