카카오챗봇 ERR_TLS_CERT_ALTNAME_INVALID 에러 문의

안녕하세요!!
카카오 챗봇 인증블록 관련 문의드립니다!!

0|bot  | 2024-09-04T13:40:32: POST /auth - - ms - -
0|bot  | 2024-09-04T13:41:37: {
0|bot  | 2024-09-04T13:41:37:   'content-type': 'application/json',
0|bot  | 2024-09-04T13:41:37:   rest_api_key: '',
0|bot  | 2024-09-04T13:41:37:   'x-request-id': 'lazenca-e88e3302ba76472c9a79d96a61a154be',
0|bot  | 2024-09-04T13:41:37:   'x-chappie-footprint': 'chp-3685579ceaf04c76bb913d168c89bbbd',
0|bot  | 2024-09-04T13:41:37:   'content-length': '1338',
0|bot  | 2024-09-04T13:41:37:   accept: '*/*',
0|bot  | 2024-09-04T13:41:37:   'user-agent': 'AHC/2.1',
0|bot  | 2024-09-04T13:41:37:   host: 'chatbot.sotalk.info:9001',
0|bot  | 2024-09-04T13:41:37:   via: '1.1 bot-proxy003 (squid)',
0|bot  | 2024-09-04T13:41:37:   'cache-control': 'max-age=259200',
0|bot  | 2024-09-04T13:41:37:   connection: 'keep-alive'
0|bot  | 2024-09-04T13:41:37: }
0|bot  | 2024-09-04T13:41:37: logToDB
0|bot  | 2024-09-04T13:41:37: { pa_api: '/kakao-auth', id: '2895031040' }
0|bot  | 2024-09-04T13:41:37: 20240904134137481
0|bot  | 2024-09-04T13:41:37: {
0|bot  | 2024-09-04T13:41:37:     "bot": {
0|bot  | 2024-09-04T13:41:37:         "id": "63f842cdc0520a77c5aec489",
0|bot  | 2024-09-04T13:41:37:         "name": "소톡봇"
0|bot  | 2024-09-04T13:41:37:     },
0|bot  | 2024-09-04T13:41:37:     "intent": {
0|bot  | 2024-09-04T13:41:37:         "id": "6496df47e4c5df07710106e1",
0|bot  | 2024-09-04T13:41:37:         "name": "인증 블록",
0|bot  | 2024-09-04T13:41:37:         "extra": {
0|bot  | 2024-09-04T13:41:37:             "reason": {
0|bot  | 2024-09-04T13:41:37:                 "code": 0,
0|bot  | 2024-09-04T13:41:37:                 "message": "OK"
0|bot  | 2024-09-04T13:41:37:             }
0|bot  | 2024-09-04T13:41:37:         }
0|bot  | 2024-09-04T13:41:37:     },
0|bot  | 2024-09-04T13:41:37:     "action": {
0|bot  | 2024-09-04T13:41:37:         "id": "64a22dbb90088a2cf5c3c226",
0|bot  | 2024-09-04T13:41:37:         "name": "00-인증-프로필플러그인",
0|bot  | 2024-09-04T13:41:37:         "params": {
0|bot  | 2024-09-04T13:41:37:             "auth": "{\"otp\":\"https://talk-plugin-capi.kakao.com/otp/66d863911983420c7ec054f2/profile\",\"app_user_id\":2895031040}"
0|bot  | 2024-09-04T13:41:37:         },
0|bot  | 2024-09-04T13:41:37:         "detailParams": {
0|bot  | 2024-09-04T13:41:37:             "auth": {
0|bot  | 2024-09-04T13:41:37:                 "groupName": "",
0|bot  | 2024-09-04T13:41:37:                 "origin": "https://talk-plugin-capi.kakao.com/otp/66d863911983420c7ec054f2/profile",
0|bot  | 2024-09-04T13:41:37:                 "value": "{\"otp\":\"https://talk-plugin-capi.kakao.com/otp/66d863911983420c7ec054f2/profile\",\"app_user_id\":2895031040}"
0|bot  | 2024-09-04T13:41:37:             }
0|bot  | 2024-09-04T13:41:37:         },
0|bot  | 2024-09-04T13:41:37:         "clientExtra": {}
0|bot  | 2024-09-04T13:41:37:     },
0|bot  | 2024-09-04T13:41:37:     "userRequest": {
0|bot  | 2024-09-04T13:41:37:         "block": {
0|bot  | 2024-09-04T13:41:37:             "id": "6496df47e4c5df07710106e1",
0|bot  | 2024-09-04T13:41:37:             "name": "인증 블록"
0|bot  | 2024-09-04T13:41:37:         },
0|bot  | 2024-09-04T13:41:37:         "user": {
0|bot  | 2024-09-04T13:41:37:             "id": "eefc7bb8a65b4c89b6a6862511f13f7d9c697c4fa88aecae44b37508e6d656ea50",
0|bot  | 2024-09-04T13:41:37:             "type": "botUserKey",
0|bot  | 2024-09-04T13:41:37:             "properties": {
0|bot  | 2024-09-04T13:41:37:                 "botUserKey": "eefc7bb8a65b4c89b6a6862511f13f7d9c697c4fa88aecae44b37508e6d656ea50",
0|bot  | 2024-09-04T13:41:37:                 "appUserStatus": "REGISTERED",
0|bot  | 2024-09-04T13:41:37:                 "isFriend": true,
0|bot  | 2024-09-04T13:41:37:                 "app_user_status": "REGISTERED",
0|bot  | 2024-09-04T13:41:37:                 "app_user_id": "2895031040",
0|bot  | 2024-09-04T13:41:37:                 "plusfriendUserKey": "fHORsZB6FrwP",
0|bot  | 2024-09-04T13:41:37:                 "appUserId": "2895031040",
0|bot  | 2024-09-04T13:41:37:                 "bot_user_key": "eefc7bb8a65b4c89b6a6862511f13f7d9c697c4fa88aecae44b37508e6d656ea50",
0|bot  | 2024-09-04T13:41:37:                 "plusfriend_user_key": "fHORsZB6FrwP"
0|bot  | 2024-09-04T13:41:37:             }
0|bot  | 2024-09-04T13:41:37:         },
0|bot  | 2024-09-04T13:41:37:         "utterance": "인증하기",
0|bot  | 2024-09-04T13:41:37:         "params": {
0|bot  | 2024-09-04T13:41:37:             "surface": "Kakaotalk.plusfriend"
0|bot  | 2024-09-04T13:41:37:         },
0|bot  | 2024-09-04T13:41:37:         "lang": "ko",
0|bot  | 2024-09-04T13:41:37:         "timezone": "Asia/Seoul"
0|bot  | 2024-09-04T13:41:37:     },
0|bot  | 2024-09-04T13:41:37:     "contexts": []
0|bot  | 2024-09-04T13:41:37: }

요렇게 인증블록 요청은 잘오는데

Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate’saltnames: Host: talk-plugin-capi.kakao.com. is not in the cert’s altnames: DNS:dashboard.sotalk.info
라는 에러가 나버립니다!! 최근 https등록후 나는 에러같은데 해결버이있을까요?ㅠㅠ

cause: Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate’s altnames: Host: talk-plugin-capi.kakao.com. is not in the cert’s altnames: DNS:dashboard.sotalk.info

이것이 핵심에러인것 같습니다.

DNS가 sotalk.info 으로 되어 있는데요 구현하신 코드 공유 부탁드립니다.

네!! 저희 코드는 npde.js로 되어있습니다

그래서 app.js 코드는 아래와 같으며

var createError = require("http-errors");
var express = require("express");
var path = require("path");
var cookieParser = require("cookie-parser");
var logger = require("morgan");

var indexRouter = require("./routes/index");
var usersRouter = require("./routes/users");
var apiRouter = require("./routes/api");
var authRouter = require("./auth/auth");

var app = express();

// view engine setup
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "pug");

app.use(logger("dev"));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, "public")));

app.use("/", indexRouter);
app.use("/users", usersRouter);
app.use("/api", apiRouter);
app.use("/auth", authRouter);

// catch 404 and forward to error handler
app.use(function (req, res, next) {
    next(createError(404));
});

// error handler
app.use(function (err, req, res, next) {
    console.log(err);
    // set locals, only providing error in development
    res.locals.message = err.message;
    res.locals.error = req.app.get("env") === "development" ? err : {};

    // render the error page
    res.status(err.status || 500);
    res.render("error");
});

module.exports = app;

지금 문제가되는 auth.js는 아래아 같습니다

var express = require("express");
var router = express.Router();

const rp = require("request-promise");
const axios = require("axios");

const rest_api_key = "";

const ui = require("../kakao/ui.js");
const config = require("../db/config.js");
const mysql = require("../mysql/sql.js");
const util = require("../util/util.js");

async function getUserDataOTP(pa_otp, rest_api_key) {
    const options = {
        method: "GET",
        uri: pa_otp,
        qs: {
            rest_api_key: rest_api_key,
        },
    };
    try {
        const response = await rp(options);
        return Promise.resolve(response);
    } catch (error) {
        return Promise.reject(error);
    }
}

async function addAuthData(
    pa_data,
    pa_sheet_app_id,
    pa_rest_api_key,
    pa_command
) {
    console.log({ pa_data, pa_sheet_app_id });
    setAuthData(pa_data[0], {
        nickname: pa_data[1],
        phone_number: pa_data[2],
        email: pa_data[3],
    });
    let response = await axios({
        method: "post",
        url: sheetPath[0] + pa_sheet_app_id + sheetPath[1],
        data: {
            data: pa_data,
            rest_api_key: pa_rest_api_key,
            command: pa_command,
        },
    });
    console.log(response.data);
}

function logToDB(pa_api, pa_app_id, pa_id) {
    console.log("logToDB");

    let id = pa_app_id;
    if (id === "") {
        id = pa_id;
    }
    console.log({ pa_api, id });
    mysql.logApi(pa_api, id, "POST");
}

router.post("/", async function (request, response, next) {
    const headers = request.headers;
    console.log(headers);
    let result;

    let openbuilderData = ui.getUserData(request.body);
    logToDB("/kakao-auth", openbuilderData.app_id, openbuilderData.id);

    


    if (headers.rest_api_key === undefined) {
        result = ui.simpleCard("카카오톡 아이디를 확인해 주세요.");
        console.log("checkUser bad uid");
        return response.status(200).json(result);
    }

    let data = request.body;
    console.log(JSON.stringify(data, null, 4));
    console.log(data.action.params.auth);

    let context = "";
    let writing = "kakaoad";

    if (data.contexts[0] !== undefined && data.contexts[0].name !== undefined) {
        context = data.contexts[0].name;
        if (context.indexOf(",") !== -1) {
            let split = context.split(",");
            context = split[0];
            writing = split[1];
        }
    }
    console.log({ context });

    let otpPath = data.action.params.auth;
    if (!otpPath) {
        result = simpleCard("인증 경로를 다시 확인해 주세요.");
        return response.status(200).json(result);
    }

    /*

    let contextName = data.contexts[0].name;
    console.log({ contextName });

    */

    let userPath = JSON.parse(otpPath);
    let otp = userPath.otp;
    let app_user_id = userPath.app_user_id;
    //console.log({ userPath });
    //console.log({ otp, app_user_id });
    const rest_api_key = headers.rest_api_key;
    let result_data = await getUserDataOTP(otp, rest_api_key);

    result_data = JSON.parse(result_data);
    //


    result_data.phone_number = "0" + result_data.phone_number.split(" ")[1];
    console.log({ result_data }); //출력 확인 함.

    /* let responseJson = {
        version: "2.0",
        data: {
            name: result_data.nickname,
            phone: result_data.phone_number,
        },
    };
 */
    
    let blockData = config.getConfig("logined");

    let sql = blockData.sql;
    console.log({ sql });
    let sqls = sql.split("\n");

    //util.getYMDHMS()
    let date = util.getYMDHMS();
    try {
        let signupResult = await mysql.insertQueryResult(sqls[0], [
            app_user_id,
            util.getEncryption(result_data.nickname),
            util.getEncryption(result_data.email),
            util.getEncryption(result_data.phone_number),
            "",
            "",
            "",
            util.getEncryption(result_data.profile_image_url),
            date,
            util.getEncryption(result_data.nickname),
            util.getEncryption(result_data.email),
            util.getEncryption(result_data.phone_number),
            "",
            "",
            "",
            util.getEncryption(result_data.profile_image_url),
            date,
        ]);
        console.log({ signupResult });

        //>> kakao_key, 90일 이후 yyyymmdd, 현시간 yyyymmddHHMMSSS,  현시간 yyyymmddHHMMSSS
        const now = new Date();
        let d90 = new Date(now.setDate(now.getDate() + 90));
        let d90Str = util.getYMD(d90);

        let statusInsertResult = await mysql.insertQueryResult(sqls[1], [
            app_user_id,
            d90Str,
            date,
            date,
        ]);
        console.log({ statusInsertResult });

        //>> kakao_key,  현시간 yyyymmddHHMMSSS,  현시간 yyyymmddHHMMSSS,  현시간 yyyymmddHHMMSSS
        let statusHistoryInsertResult = await mysql.insertQueryResult(sqls[2], [
            app_user_id,
            date,
            date,
            date,
        ]);
        console.log({ statusHistoryInsertResult });


    } catch (error) {
        console.log(error)
    }
    
    let cardData = util.getCardData(blockData.card, app_user_id);

    let card = ui.getCarousel(cardData);
    let quick = ui.getJson_quicks(blockData.quick);
    let json = ui.getResponseJSON({}, card, quick);
    return response.send(json);
});

module.exports = router;

그런데 DNS가 문제라면 혹시 서버의 설정 자체가 문제가되는걸수도 있을까요!?

위 라이브러리 사용하지 않고 테스트해보시겠어요? axios만 사용 부탁드립니다.