jenkinsci / telegram-notifications-plugin

This plugin allows you to send messages from Jenkins jobs to Telegram chat.
https://plugins.jenkins.io/telegram-notifications/
MIT License
72 stars 62 forks source link

Exception during send message. #67

Open jincod opened 3 years ago

jincod commented 3 years ago

Version report

Jenkins and plugins versions report:

Jenkins: 2.277.1
OS: Linux - 5.4.0-66-generic
---
generic-webhook-trigger:1.72
branch-api:2.6.2
config-file-provider:3.7.0
blueocean-github-pipeline:1.24.4
conditional-buildstep:1.4.1
antisamy-markup-formatter:2.1
pipeline-model-definition:1.8.4
jdk-tool:1.5
resource-disposer:0.14
github:1.33.1
docker-java-api:3.1.5.2
matrix-project:1.18
github-pr-coverage-status:2.1.1
email-ext:2.81
pipeline-github:2.7
docker-plugin:1.2.2
blueocean-jira:1.24.4
pipeline-stage-tags-metadata:1.8.4
cloudbees-folder:6.15
lockable-resources:2.10
ant:1.11
sse-gateway:1.24
docker-workflow:1.25
blueocean-commons:1.24.4
javadoc:1.6
okhttp-api:3.14.9
blueocean-pipeline-editor:1.24.4
workflow-step-api:2.23
pollscm:1.3.1
blueocean-git-pipeline:1.24.4
telegram-notifications:1.4.0
multibranch-scan-webhook-trigger:1.0.5
jquery-detached:1.2.1
pipeline-multibranch-defaults:2.1
jenkins-design-language:1.24.4
git-client:3.6.0
blueocean-web:1.24.4
pipeline-stage-view:2.19
plugin-util-api:1.7.1
blueocean-bitbucket-pipeline:1.24.4
workflow-scm-step:2.11
gradle:1.36
mailer:1.32.1
pipeline-rest-api:2.19
blueocean-i18n:1.24.4
git:4.6.0
workflow-cps-global-lib:2.17
icon-shim:2.0.3
authentication-tokens:1.4
plain-credentials:1.7
checks-api:1.5.0
blueocean-display-url:2.4.1
structs:1.22
blueocean-rest:1.24.4
maven-plugin:3.8
apache-httpcomponents-client-4-api:4.5.13-1.0
durable-task:1.35
blueocean-jwt:1.24.4
ssh-slaves:1.31.5
command-launcher:1.5
blueocean:1.24.4
github-branch-source:2.9.6
parameterized-trigger:2.39
blueocean-dashboard:1.24.4
echarts-api:4.9.0-3
handy-uri-templates-2-api:2.1.8-1.0
pam-auth:1.6
blueocean-autofavorite:1.2.4
workflow-job:2.40
jjwt-api:0.11.2-9.c8b45b8bb173
jquery:1.12.4-1
favorite:2.3.2
ace-editor:1.1
jquery3-api:3.5.1-2
workflow-cps:2.89
handlebars:1.1.1
blueocean-pipeline-api-impl:1.24.4
snakeyaml-api:1.27.0
jira:3.2
blueocean-pipeline-scm-api:1.24.4
htmlpublisher:1.25
blueocean-rest-impl:1.24.4
bootstrap4-api:4.6.0-1
blueocean-config:1.24.4
scm-api:2.6.4
matrix-auth:2.6.6
pipeline-githubnotify-step:1.0.5
pipeline-build-step:2.13
cloudbees-bitbucket-branch-source:2.9.7
ssh-credentials:1.18.1
momentjs:1.1.1
workflow-aggregator:2.6
jsch:0.1.55.2
mercurial:2.12
credentials-binding:1.24
pipeline-input-step:2.12
display-url-api:2.3.4
github-api:1.122
pipeline-github-lib:1.0
workflow-api:2.41
build-with-parameters:1.5
github-pullrequest:0.2.8
ansible:1.1
variant:1.4
pipeline-model-extensions:1.8.4
pubsub-light:1.13
bouncycastle-api:2.18
pipeline-model-api:1.8.4
blueocean-events:1.24.4
timestamper:1.11.8
git-server:1.9
ws-cleanup:0.38
pipeline-graph-analysis:1.10
workflow-basic-steps:2.23
popper-api:1.16.1-1
blueocean-core-js:1.24.4
blueocean-personalization:1.24.4
workflow-multibranch:2.22
ldap:1.26
docker-commons:1.17
token-macro:2.13
workflow-support:3.7
script-security:1.76
font-awesome-api:5.15.2-1
workflow-durable-task-step:2.37
run-condition:1.5
jackson2-api:2.12.1
credentials:2.3.15
junit:1.48
build-timeout:1.20
trilead-api:1.0.13
pipeline-stage-step:2.5
pipeline-milestone-step:1.3.2
Parameterized-Remote-Trigger:3.1.5.1
Result: [Plugin:generic-webhook-trigger, Plugin:branch-api, Plugin:config-file-provider, Plugin:blueocean-github-pipeline, Plugin:conditional-buildstep, Plugin:antisamy-markup-formatter, Plugin:pipeline-model-definition, Plugin:jdk-tool, Plugin:resource-disposer, Plugin:github, Plugin:docker-java-api, Plugin:matrix-project, Plugin:github-pr-coverage-status, Plugin:email-ext, Plugin:pipeline-github, Plugin:docker-plugin, Plugin:blueocean-jira, Plugin:pipeline-stage-tags-metadata, Plugin:cloudbees-folder, Plugin:lockable-resources, Plugin:ant, Plugin:sse-gateway, Plugin:docker-workflow, Plugin:blueocean-commons, Plugin:javadoc, Plugin:okhttp-api, Plugin:blueocean-pipeline-editor, Plugin:workflow-step-api, Plugin:pollscm, Plugin:blueocean-git-pipeline, Plugin:telegram-notifications, Plugin:multibranch-scan-webhook-trigger, Plugin:jquery-detached, Plugin:pipeline-multibranch-defaults, Plugin:jenkins-design-language, Plugin:git-client, Plugin:blueocean-web, Plugin:pipeline-stage-view, Plugin:plugin-util-api, Plugin:blueocean-bitbucket-pipeline, Plugin:workflow-scm-step, Plugin:gradle, Plugin:mailer, Plugin:pipeline-rest-api, Plugin:blueocean-i18n, Plugin:git, Plugin:workflow-cps-global-lib, Plugin:icon-shim, Plugin:authentication-tokens, Plugin:plain-credentials, Plugin:checks-api, Plugin:blueocean-display-url, Plugin:structs, Plugin:blueocean-rest, Plugin:maven-plugin, Plugin:apache-httpcomponents-client-4-api, Plugin:durable-task, Plugin:blueocean-jwt, Plugin:ssh-slaves, Plugin:command-launcher, Plugin:blueocean, Plugin:github-branch-source, Plugin:parameterized-trigger, Plugin:blueocean-dashboard, Plugin:echarts-api, Plugin:handy-uri-templates-2-api, Plugin:pam-auth, Plugin:blueocean-autofavorite, Plugin:workflow-job, Plugin:jjwt-api, Plugin:jquery, Plugin:favorite, Plugin:ace-editor, Plugin:jquery3-api, Plugin:workflow-cps, Plugin:handlebars, Plugin:blueocean-pipeline-api-impl, Plugin:snakeyaml-api, Plugin:jira, Plugin:blueocean-pipeline-scm-api, Plugin:htmlpublisher, Plugin:blueocean-rest-impl, Plugin:bootstrap4-api, Plugin:blueocean-config, Plugin:scm-api, Plugin:matrix-auth, Plugin:pipeline-githubnotify-step, Plugin:pipeline-build-step, Plugin:cloudbees-bitbucket-branch-source, Plugin:ssh-credentials, Plugin:momentjs, Plugin:workflow-aggregator, Plugin:jsch, Plugin:mercurial, Plugin:credentials-binding, Plugin:pipeline-input-step, Plugin:display-url-api, Plugin:github-api, Plugin:pipeline-github-lib, Plugin:workflow-api, Plugin:build-with-parameters, Plugin:github-pullrequest, Plugin:ansible, Plugin:variant, Plugin:pipeline-model-extensions, Plugin:pubsub-light, Plugin:bouncycastle-api, Plugin:pipeline-model-api, Plugin:blueocean-events, Plugin:timestamper, Plugin:git-server, Plugin:ws-cleanup, Plugin:pipeline-graph-analysis, Plugin:workflow-basic-steps, Plugin:popper-api, Plugin:blueocean-core-js, Plugin:blueocean-personalization, Plugin:workflow-multibranch, Plugin:ldap, Plugin:docker-commons, Plugin:token-macro, Plugin:workflow-support, Plugin:script-security, Plugin:font-awesome-api, Plugin:workflow-durable-task-step, Plugin:run-condition, Plugin:jackson2-api, Plugin:credentials, Plugin:junit, Plugin:build-timeout, Plugin:trilead-api, Plugin:pipeline-stage-step, Plugin:pipeline-milestone-step, Plugin:Parameterized-Remote-Trigger]
Docker jenkinceci\jenkinsci:2.277.1-alpine

Reproduction steps

Jenkinsfile:

telegramSend chatId: "$CHAT_ID", message: "Error during build: ${BUILD_URL}"

Results

Expected result:

Message sends

Actual result:

java.lang.IllegalStateException
    at org.objectweb.asm.tree.analysis.BasicInterpreter.<init>(BasicInterpreter.java:66)
    at org.parboiled.transform.RuleMethodInterpreter.<init>(RuleMethodInterpreter.java:42)
    at org.parboiled.transform.InstructionGraphCreator.process(InstructionGraphCreator.java:41)
    at org.parboiled.transform.ParserTransformer.runMethodTransformers(ParserTransformer.java:62)
    at org.parboiled.transform.ParserTransformer.extendParserClass(ParserTransformer.java:45)
    at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:39)
    at org.parboiled.Parboiled.createParser(Parboiled.java:54)
Caused: java.lang.RuntimeException: Error creating extended parser class: null
    at org.parboiled.Parboiled.createParser(Parboiled.java:58)
    at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:80)
    at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:74)
    at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:199)
    at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:237)
    at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:207)
    at jenkinsci.plugins.telegrambot.telegram.TelegramBot.expandMessage(TelegramBot.java:92)
    at jenkinsci.plugins.telegrambot.telegram.TelegramBot.sendMessage(TelegramBot.java:104)
    at jenkinsci.plugins.telegrambot.TelegramBotMessager.perform(TelegramBotMessager.java:71)
    at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
miszterx commented 3 years ago

Hi,

I have the same issue. However I think it is coming from the issue that in Configure Systems If I try to do a save now:

2021-03-25 12:18:51.772+0000 [id=12] WARNING o.e.j.s.h.ContextHandler$Context#log: Error while serving http://server/configSubmit net.sf.json.JSONException: JSONObject["shouldLogToConsole"] is not a Boolean.

And I got this error on the web site:

Oops! A problem occurred while processing the request.

The shouldLogToConsole is part of the telegram bot part:

Log to console
Check if we should log messages to Jenkins console

If I disable the plugin the Configure System part can be saved. Probably the option is not handled properly.

jincod commented 3 years ago

Hello @miszterx

Updated Token Macro Plugin to 2.15. Issue has been resolved.

Can I close this issue?

miszterx commented 3 years ago

Hmm. I have this with Token Macro Plugin 2.15 :( All plugins uptodate and I have ubuntu 20.04 with jenkins 2.277.1.

leearic commented 3 years ago

hi i have the same issue here is the log 2021-04-02 08:35:10.027+0000 [id=31] INFO jenkins.InitReactorRunner$1#onAttained: Loaded all jobs 2021-04-02 08:35:10.027+0000 [id=34] INFO jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated 2021-04-02 08:35:10.075+0000 [id=49] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Download metadata 2021-04-02 08:35:10.091+0000 [id=49] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 15 ms 2021-04-02 08:35:10.145+0000 [id=33] INFO jenkins.InitReactorRunner$1#onAttained: Completed initialization 2021-04-02 08:35:10.162+0000 [id=21] INFO hudson.WebAppMain$3#run: Jenkins is fully up and running 2021-04-02 08:35:10.368+0000 [id=42] INFO j.p.t.telegram.TelegramBot#initializeProxy: Proxy successfully initialized 2021-04-02 08:35:10.373+0000 [id=42] INFO j.p.t.telegram.TelegramBotRunner#lambda$new$0: Bot was created 2021-04-02 08:35:11.833+0000 [id=42] SEVERE j.p.t.telegram.TelegramBotRunner#createBotSession: Telegram API error org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException: Error deleting webhook: [404] Not Found at org.telegram.telegrambots.meta.api.methods.updates.DeleteWebhook.deserializeResponse(DeleteWebhook.java:39) at org.telegram.telegrambots.meta.api.methods.updates.DeleteWebhook.deserializeResponse(DeleteWebhook.java:18) at jenkinsci.plugins.telegrambot.telegram.TelegramBot.sendApiMethodWithProxy(TelegramBot.java:239) at jenkinsci.plugins.telegrambot.telegram.TelegramBot.execute(TelegramBot.java:170) at org.telegram.telegrambots.util.WebhookUtils.clearWebhook(WebhookUtils.java:74) Caused: org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException: Error removing old webhook at org.telegram.telegrambots.util.WebhookUtils.clearWebhook(WebhookUtils.java:79) at org.telegram.telegrambots.bots.TelegramLongPollingBot.clearWebhook(TelegramLongPollingBot.java:25) at org.telegram.telegrambots.meta.TelegramBotsApi.registerBot(TelegramBotsApi.java:120) at jenkinsci.plugins.telegrambot.telegram.TelegramBotRunner.createBotSession(TelegramBotRunner.java:71) at jenkinsci.plugins.telegrambot.telegram.TelegramBotRunner.lambda$new$0(TelegramBotRunner.java:61) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) here is jenkins version: ii jenkins 2.286 all Jenkins is an open source automation server which enables developers around the world to reliably automate their development lifecycle

and here is the plugin version: image

server : Ubuntu 20.10 \n \l

maybe the TelegramBots API is so old?, need 5.1.1?