acmesh-official / acme.sh

A pure Unix shell script implementing ACME client protocol
https://acme.sh
GNU General Public License v3.0
39.65k stars 5k forks source link

Report bugs to telegram notify #3356

Open mjbnz opened 3 years ago

mjbnz commented 3 years ago

This is the place to report bugs in the Telegram notify.

If you experience a bug, please report it in this issue.

Thanks!

leezicai commented 3 years ago

I want notify ".example.com", but i received ".example.com", the "\" is miss

pd12bbf7608ae1 commented 3 years ago

Telegram notice hook return an error, here is the log:

telegram send error. {"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 246"}

mjbnz commented 3 years ago

If both of you could add _err "$_data" just before the return 1 at the end of the notify script, try again, and send me the results I'll be able to diagnose further.

Redact your chatid that will appear, and any ascii parts of the domains. The issues you're seeing are directly related to the content of that variable, so I'll need to see as much of it not edited as possible.

leezicai commented 3 years ago

acme.sh --set-notify --notify-level 3

add _err "$_data" at the end of the notify script.

acme.sh --cron

{"ok":true,"result":{"message_id":36,"from":{"id":000000,"is_bot":true,"first_name":"testBot","username":"testBot"},"chat":{"id":00000000,"first_name":"W","username":"test","type":"private"},"date":000000000,"text":"Renew Skipped\nSkipped certs:\n .example.com\n ","entities":[{"offset":0,"length":13,"type":"bold"},{"offset":33,"length":17,"type":"bold"},{"offset":50,"length":11,"type":"url"},{"offset":50,"length":11,"type":"bold"},{"offset":66,"length":13,"type":"url"},{"offset":66,"length":13,"type":"bold"},{"offset":104,"length":14,"type":"url"},{"offset":123,"length":13,"type":"url"}]}}[Thu Apr 8 10:27:29 CST 2021] telegram send success.

leezicai commented 3 years ago

➜ notify acme.sh --version https://github.com/acmesh-official/acme.sh v2.8.9

Neilpang commented 3 years ago

@mjbnz

If both of you could add _err "$_data" just before the return 1 at the end of the notify script, t

Please add it and submit a PR.

Thanks.

mjbnz commented 3 years ago

@Neilpang

Please add it and submit a PR.

This is just for debugging these couple of instances, it's not how it should be done going forward.

Neilpang commented 3 years ago

@mjbnz

You can use _debug2 "$data" instead of _err.

this will save your debug time next time.

mjbnz commented 3 years ago

@Charles-one

{"ok":true,...... [Thu Apr 8 10:27:29 CST 2021] telegram send success.

Yours worked correctly so the _err call wouldn't have run.. Reviewing the main script however, it should show the *. Did the domain appear with the * earier in the output preceeded with "Skipped" ? If so, I'll do some more testing. If not, it looks like a bug in the main script.

mjbnz commented 3 years ago

@mjbnz

You can use _debug2 "$data" instead of _err.

this will save your debug time next time.

Understood, I'll add it in a PR later if changes are needed for these failures.

leezicai commented 3 years ago

@mjbnz

@Charles-one

{"ok":true,...... [Thu Apr 8 10:27:29 CST 2021] telegram send success.

Yours worked correctly so the _err call wouldn't have run.. Reviewing the main script however, it should show the *. Did the domain appear with the * earier in the output preceeded with "Skipped" ? If so, I'll do some more testing. If not, it looks like a bug in the main script.

===Starting cron=== [Thu Apr 8 10:45:17 CST 2021] Renew: '.example.com' [Thu Apr 8 10:45:17 CST 2021] Skip, Next renewal time is: Tue Jun 1 03:10:38 UTC 2021 [Thu Apr 8 10:45:17 CST 2021] Add '--force' to force to renew. [Thu Apr 8 10:45:17 CST 2021] Skipped .example.com [Thu Apr 8 10:45:17 CST 2021] Sending via: telegram

mjbnz commented 3 years ago

[Thu Apr 8 10:45:17 CST 2021] Skipped *.example.com

Perfect thanks, I'll look into it.

mjbnz commented 3 years ago

PR made to address this in #3479

leewp14 commented 3 years ago

I'm facing similar to the above one too. How can I help to check on the problem?

[Tue Jul 27 15:40:20 UTC 2021] Sending via: telegram [Tue Jul 27 15:40:21 UTC 2021] telegram send error. [Tue Jul 27 15:40:21 UTC 2021] {"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 96"} [Tue Jul 27 15:40:21 UTC 2021] Error send message by telegram_send [Tue Jul 27 15:40:21 UTC 2021] Set /home/leewp14/bin/acme.sh/notify/telegram.sh error. [Tue Jul 27 15:40:21 UTC 2021] ===End cron=== leewp14@compute-arm-default: nan/bin/acme.sh$ ./acme.sh --set-notify --notify-hook telegram [Tue Jul 27 15:44:29 UTC 2021] Set notify hook to: telegram [Tue Jul 27 15:44:29 UTC 2021] Sending via: telegram [Tue Jul 27 15:44:30 UTC 2021] telegram send success. [Tue Jul 27 15:44:30 UTC 2021] telegram Success leewp14@compute-arm-default: nan/bin/acme.sh$

The test message can be sent and received on TG, however the hook send is not working. Using version 3.0.0.

mjbnz commented 3 years ago

I'm facing similar to the above one too. How can I help to check on the problem?

[Tue Jul 27 15:40:21 UTC 2021] {"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 96"}

What is the domain you're requesting? Does it have an underscore?

leewp14 commented 3 years ago

I'm facing similar to the above one too. How can I help to check on the problem?

[Tue Jul 27 15:40:21 UTC 2021] {"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 96"}

What is the domain you're requesting? Does it have an underscore?

Nope, my domain is mitsuha.ren and hcdn.mitsuha.ren.

mjbnz commented 3 years ago

Nope, my domain is mitsuha.ren and hcdn.mitsuha.ren.

Hmm, ok, can you run a renew with the debug flag please.

knightly-flo commented 2 years ago

Why not use HTML instead of markdown? I had the same error "Bad Request: can't parse entities" as mentioned above because my domain contained asterisk (*.example.com). After looking in it, changing parse_mode to html and using <b></b> tags for bold text instead of ** markdown syntax, everything works fine. This also doesn't requires to use sed to escape special characters like *.

fazelukario commented 1 month ago

Broken markdown

Payload: {"text": "*Renew *.example.com success by mylovelyhost*\nGood, the cert is renewed.\n", "chat_id": "722542009", "parse_mode": "markdown", "disable_web_page_preview": "1"}

Error: {"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 47"}