You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"component":"main","level":"info","msg":"Post \"https://api.line.me/v2/bot/message/reply\": tls: failed to verify certificate: x509: certificate signed by unknown authority","time":"2023-12-18T10:36:06Z"}
Steps to Reproduce
Here is part of my code
package line
import (
"net/http""github.com/gin-gonic/gin""github.com/line/line-bot-sdk-go/v8/linebot/messaging_api""github.com/line/line-bot-sdk-go/v8/linebot/webhook"
)
var (
log=utils.GetLogger()
)
funcLINEHandler(c*gin.Context) {
path:=c.Param("action")
// Use a switch case to redirect to different functionsswitchpath {
case"/callback":
callback(c)
default:
c.JSON(http.StatusNotFound, gin.H{"message": "Not found"})
}
}
funccallback(c*gin.Context) {
bot, err:=messaging_api.NewMessagingApiAPI(utils.GetLINEConfig().LINEChannelAccessToken)
iferr!=nil {
log.WithField("component", "line").Errorf("Failed to create new bot: %s", err)
c.JSON(http.StatusInternalServerError, gin.H{"message": "Internal server error"})
return
}
cb, err:=webhook.ParseRequest(utils.GetLINEConfig().LINEChannelSecret, c.Request)
iferr!=nil {
log.WithField("component", "line").Errorf("Failed to parse request: %s", err)
iferr==webhook.ErrInvalidSignature {
c.JSON(http.StatusBadRequest, gin.H{"message": "Invalid signature"})
} else {
c.JSON(http.StatusInternalServerError, gin.H{"message": "Internal server error"})
}
return
}
for_, event:=rangecb.Events {
switche:=event.(type) {
case webhook.MessageEvent:
switchmessage:=e.Message.(type) {
case webhook.TextMessageContent:
if_, err=bot.ReplyMessage(
&messaging_api.ReplyMessageRequest{
ReplyToken: e.ReplyToken,
Messages: []messaging_api.MessageInterface{
messaging_api.TextMessage{
Text: message.Text,
},
},
},
); err!=nil {
log.Print(err)
} else {
log.Println("Sent text reply.")
}
default:
log.WithField("component", "line").Errorf("Unsupported message: %T\n", message)
}
default:
log.WithField("component", "line").Errorf("Unsupported event: %T\n", event)
}
}
}
It seems my code can get the message event correctly, but I just couldn't send the message. Any help is appreciated.
The text was updated successfully, but these errors were encountered:
OK... so I found where the problem is. The error is caused by not copy SSL certificates to /etc/ssl/certs/ca-certificates.crt, and copying it to the path will solve this error. Issue closed.
System Informations
Expected Behavior
Reply/Push messages successfully
Current Behavior
Steps to Reproduce
Here is part of my code
It seems my code can get the message event correctly, but I just couldn't send the message. Any help is appreciated.
The text was updated successfully, but these errors were encountered: