Welcome to the Linux Foundation Forum!

Lab 10.2 - Block an Attackers IP Address with Fastify -Error: read ECONNRESET on Windows

I was getting this error for lab 10.2 on Windows:

I found out the validated file for lab 10.2 has different handling for the temporal file produced by the call to writeFileSync(IP, ""); than the one used in lab 10.1, which outputs a file path without any \ on Windows.

So, I just copied and pasted the lines from lab 10.1 to the validate file for 10.2 on line 13.

From this:
const ip = join(tmp, "IP");

to this:

  1. const ip =
  2. process.platform === "win32"
  3. ? join(tmp, "ip").split("\\").join("\\\\")
  4. : join(tmp, "ip");

After that change, the tests ran fine on Windows.

Comments

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training