Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Gotify "const axios" unable to verify the first certificate
#1
Hallo,
ich habe den Selv Hostet Gotify benachrichtigungs Server der läuft erfolgreich auf HTTPS.

Vorher hatte ich Gotify als HTTP am laufen und folgenden Code im Java Script dass hatte auch funktioniert.

Code:
const axios = require("axios");
const url = "http://192.168.178.xxx/message?token=ATvOgRNF8QqwGVN";
const bodyFormData = {
  title: "Hello from Javascript",
  message: "Test Push Service from Node.js",
  priority: 5,
};
axios({
  method: "post",
  headers: {
    "Content-Type": "application/json",
  },
  url: url,
  data: bodyFormData,
})
  .then((response) => console.log(response.data))
  .catch((err) => console.log(err.response ? error.response.data : err));
```
Seit der Umstellung auf HTTPS habe ich den Code so angepasst: (nur HTTP zu HTTPS geändert)
```
const axios = require("axios");
const url = "https://192.168.178.xxx/message?token=ATvOgRNF8QqwGVN";
const bodyFormData = {
  title: "Hello from Javascript",
  message: "Test Push Service from Node.js",
  priority: 5,
};
axios({
  method: "post",
  headers: {
    "Content-Type": "application/json",
  },
  url: url,
  data: bodyFormData,
})
  .then((response) => console.log(response.data))
  .catch((err) => console.log(err.response ? error.response.data : err));


Seit der Umstellung auf HTTPS habe ich den Code so angepasst: (nur HTTP zu HTTPS geändert)

Code:
const axios = require("axios");
const url = "https://192.168.178.xxx/message?token=ATvOgRNF8QqwGVN";
const bodyFormData = {
  title: "Hello from Javascript",
  message: "Test Push Service from Node.js",
  priority: 5,
};
axios({
  method: "post",
  headers: {
    "Content-Type": "application/json",
  },
  url: url,
  data: bodyFormData,
})
  .then((response) => console.log(response.data))
  .catch((err) => console.log(err.response ? error.response.data : err));

Seitdem bekomme ich folgende fehlermeldung.
Ich habe zwar schon im Internet geschaut aber ich bin bischer leider erfolglos.

Code:
{'message':'unable to verify the first certificate','name':'Error','stack':'Error: unable to verify the first certificate\n at Function.AxiosError.from (/opt/iobroker/node_modules/iobroker.javascript/node_modules/axios/dist/node/axios.cjs:837:14)\n at RedirectableRequest.handleRequestError (/opt/iobroker/node_modules/iobroker.javascript/node_modules/axios/dist/node/axios.cjs:3016:25)\n at RedirectableRequest.emit (node:events:514:28)\n at ClientRequest.eventHandlers.<computed> (/opt/iobroker/node_modules/follow-redirects/index.js:14:24)\n at ClientRequest.emit (node:events:514:28)\n at TLSSocket.socketErrorListener (node:_http_client:501:9)\n at TLSSocket.emit (node:events:514:28)\n at emitErrorNT (node:internal/streams/destroy:151:8)\n at emitErrorCloseNT (node:internal/streams/destroy:116:3)\n at processTicksAndRejections (node:internal/process/task_queues:82:21)\n','config':{'transitional':{'silentJSONParsing':true,'forcedJSONParsing':true,'clarifyTimeoutError':false},'adapter':'http','transformRequest':[null],'transformResponse':[null],'timeout':0,'xsrfCookieName':'XSRF-TOKEN','xsrfHeaderName':'X-XSRF-TOKEN','maxContentLength':-1,'maxBodyLength':-1,'env':{},'headers':{'Accept':'application/json, text/plain, */*','Content-Type':'application/json','User-Agent':'axios/1.5.0','Content-Length':'89','Accept-Encoding':'gzip, compress, deflate, br'},'method':'post','url':'https://192.168.178.xxx/message?token=ATvOgRNF8QqwGVN','data':'{\'title\':\'Hello from Javascript\',\'message\':\'Test Push Service from Node.js\',\'priority\':5}'},'code':'UNABLE_TO_VERIFY_LEAF_SIGNATURE','status':null}

Hat einer eine idee wie ich das SSL im Code ausschalten kann oder noch besser wie ich dass mit einem Zertifikat hinbekomme also Zertifikat habe ich ja ich weiß nur nicht wie ich dass coden soll.
Zitieren


Gehe zu:


Benutzer, die gerade dieses Thema anschauen:
1 Gast/Gäste