node.js express를 사용하는 서버에서 매일 자정에 상태를 알려주는 텔레그램 봇을 사용하고 있던 도중 갑자기 알림이 안오는 현상이 발생
텔레그램으로 알림을 보내는 함수
util.tel_send = async (text) => {
const option = {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
chat_id: 'chat_id',
text
})
}
const bot_message = await fetch(`https://api.telegram.org/[BOT_TOKEN]:[REDACTED]/sendMessage`, option)
.then((res) => res.json())
.catch((error) => console.log('error', error));
return bot_message;
};
에러내용
FetchError: request to https://api.telegram.org/[BOT_TOKEN]:[REDACTED]/sendMessage failed
...
{
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT'
}
해결과정
해결후기
구글링을 열심히 해봤지만 명확한 해결방법이 없었고 소켓관련된 연결문제인 것 같다 이런 이야기가 많았음
사실 나도 이것저것 시도해 보니 해결되었지만 명확한 답은 찾지 못했다.
또 이런 현상이 발생하면 그때는 제대로 확인해 볼 예정