Как исправить 'UnhandledPromiseRejectionWarning' - PullRequest
0 голосов
/ 01 мая 2019

Я настраиваю страницу входа и регистрации, используя Okta и Express. Я попытался настроить ExpressOIDC, но затем я получаю эту ошибку:

`App listening on port 3000
(node:15664) UnhandledPromiseRejectionWarning: RequestError: connect ECONNREFUSED 75.126.102.240:443
    at ClientRequest.req.once.err (Noicefilepath/index.js:182:22)
    at Object.onceWrapper (events.js:277:13)
    at ClientRequest.emit (events.js:194:15)
    at TLSSocket.socketErrorListener (_http_client.js:392:9)
    at TLSSocket.emit (events.js:189:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:15664) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15664) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`

Код для ExpressOIDC:

const ExpressOIDC = require('@okta/oidc-middleware').ExpressOIDC;
const oidc = new ExpressOIDC({
    issuer: `${process.env.OKTA_ORG_URL}/oauth2/default`,
    client_id: process.env.OKTA_CLIENT_ID,
    client_secret: process.env.OKTA_CLIENT_SECRET,
    redirect_uri: `${process.env.HOST_URL}/authorization-code/callback`,
    appBaseUrl: process.env.HOST_URL, //the host url is http://localhost:3000
    scope: 'openid profile'
});

Как я могу это исправить? Любая помощь будет принята с благодарностью.

...