Error: read ECONNRESET when executing the javascript file

565 Views Asked by At

I want to access the Untis-API by using the npm package untis-api.

When I run the javascript file I get this error:

node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'read'
}

My Code:

const w = require("untis-api");
const e = w.entities;

w.connect("USERNAME", "PASSWORD", "SCHOOL", "URL").then(() => {
    w.getTeachers().then(teachers => {
      console.log(teachers);
    }).catch(err => {
        console.log(err);
    });

    w.logOut();
}).catch(err => {
    console.log(err);
});

How can I fix this?

I'm using Node Version 16.15.0

1

There are 1 best solutions below

0
On BEST ANSWER

It was an error at the webuntis server. Due to a DDoS Attack, the service was temporarily unavailable. This causes the error.