錯誤訊息:
The webhook returned an HTTP status code other than 200. (400 Bad Request)
Confirm that your bot server returns status code 200 in response to the HTTP POST request sent from the LINE Platform. For more information, see Response in the Messaging API Refference.
什麼是 400 Bad Request?
客戶端的配置錯誤,導致 LINE Bot Server 無法理解或處理你的請求,因此傳回 400 Bad Request 告訴你是客戶端有問題,需要修改相關配置文件。
解決 400 Bad Request 的方法:
Webhook URL 會以客戶端的形式傳送請求到你的 LINE Bot Server,第一件事,就是檢查網址有沒有問題(不要忘記在網址後面加上 /linebot/callback 目錄)。
接下來,用程式碼編輯器打開專案主程式的 settings.py,檢查 ALLOWED_HOSTS 配置是否正確,ALLOWED_HOSTS的資料必須與 Webhook URL 一致(只需保留域名)。
修改完,重新驗證 Webhook URL 就會提示「Success」成功訊息。
2023.08.13 補充,LINE Bot 伺服器出現 500 Internal Server Error 的處理方式:目前已知的錯誤來源,是因為程式在讀取 user_id 的時候出現異常。
2023.08.12 補充,當你點擊 Verify 按鈕,其實是在驗證 URL 的 SSL 憑證,如果產生其他錯誤訊息,但是 LINE Bot 功能都可以正常使用,就不用特地去處理它。
> Webhook URL cannot be verified.



沒有留言:
張貼留言