question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use nockBack?

See original GitHub issue

What am I missing here?

[~/tmp]$ cat test.js
const Wreck = require('wreck');
const nock = require('nock');
const nockBack = nock.back;

nock.enableNetConnect();
nock.enableNetConnect(/canihaz/);
nockBack.fixtures = './tmp';
nockBack.setMode('record');

Wreck.get('https://canihazip.com/s', (err, res, body) => {
  var p = require('purdy');
  p(err);
  p(res);
  p(body);
});
[~/tmp]$ node test.js
NetConnectNotAllowedError {
    name: 'NetConnectNotAllowedError',
    code: 'ENETUNREACH',
    message: 'Client request error: Nock: Not allow net connect for "canihazip.com:443/s"',
    trace: [
        [0] {
            method: 'GET',
            url: 'https://canihazip.com/s'
        }
    ],
    isBoom: true,
    isServer: true,
    data: null,
    output: {
        statusCode: 502,
        payload: {
            message: 'Client request error: Nock: Not allow net connect for "canihazip.com:443/s"',
            statusCode: 502,
            error: 'Bad Gateway'
        },
        headers: {}
    },
    reformat: [Function]
}
undefined
undefined

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
RichardLittcommented, Aug 23, 2018

Move nock.enableNetConnect(); below the nockBack fixtures and setMode lines. Then it should work. There’s also no need for multiple enableNetConnect - the first is permissive of all netConnects, and the second just limits it, so just go with one or the other.

Let me know if this works for you!

1reaction
danielb2commented, Oct 22, 2018

I never had a chance to get back to this but in my example here, I don’t see anything actually being recorded in ./tmp. Am I missing something else too?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Knockback in Minecraft - DigMinecraft
You can add the Knockback enchantment to any sword using an enchanting table, anvil, or game command. Then use the enchanted sword to...
Read more >
Knockback - Minecraft Wiki - Fandom
Knockback is an enchantment to a sword that increases the sword's knockback.
Read more >
How to use knockback influence in MultiVersus - Polygon
WB's character brawler MultiVersus has a technique called knockback influence. Here's how to use it — and how to clear the glitchy in-game ......
Read more >
How the Knockback enchantment works in Minecraft
Knockback can be placed on any sword by using an enchanting table, expending experience earned by the player and some lapis lazuli. Higher-level ......
Read more >
Knock back Definition & Meaning - Merriam-Webster
The meaning of KNOCK BACK is drink, swallow; specifically : to toss down (an alcoholic beverage).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found