jenkinsci / slack-plugin

A Jenkins plugin for posting notifications to a Slack channel
https://plugins.jenkins.io/slack/
672 stars 413 forks source link

WARNING jenkins.plugins.slack.StandardSlackService postToSlack Response Code: 404 #952

Closed asaltari closed 2 months ago

asaltari commented 3 months ago

Jenkins and plugins versions report

Environment Jenkins: 2.440.1 OS: Mac OS X - 14.4 Java: 21.0.1 - Homebrew (OpenJDK 64-Bit Server VM) --- ant:497.v94e7d9fffa_b_9 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 authentication-tokens:1.53.v1c90fd9191a_b_ blueocean:1.27.9 blueocean-bitbucket-pipeline:1.27.9 blueocean-commons:1.27.9 blueocean-config:1.27.9 blueocean-core-js:1.27.9 blueocean-dashboard:1.27.9 blueocean-display-url:2.4.2 blueocean-events:1.27.9 blueocean-git-pipeline:1.27.9 blueocean-github-pipeline:1.27.9 blueocean-i18n:1.27.9 blueocean-jwt:1.27.9 blueocean-personalization:1.27.9 blueocean-pipeline-api-impl:1.27.9 blueocean-pipeline-editor:1.27.9 blueocean-pipeline-scm-api:1.27.9 blueocean-rest:1.27.9 blueocean-rest-impl:1.27.9 blueocean-web:1.27.9 bootstrap5-api:5.3.2-3 bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9 branch-api:2.1144.v1425d1c3d5a_7 build-timeout:1.32 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.0.2 cloudbees-bitbucket-branch-source:866.vdea_7dcd3008e cloudbees-folder:6.858.v898218f3609d commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.11.0-95.v22a_d30ee5d36 config-file-provider:968.ve1ca_eb_913f8c credentials:1311.vcf0a_900b_37c2 credentials-binding:657.v2b_19db_7d6e6d display-url-api:2.200.vb_9327d658781 durable-task:543.v262f6a_803410 echarts-api:5.4.3-2 email-ext:2.104 favorite:2.208.v91d65b_7792a_c font-awesome-api:6.5.1-2 generic-webhook-trigger:2.0.0 git:5.2.1 git-client:4.6.0 github:1.37.3.1 github-api:1.318-461.v7a_c09c9fa_d63 github-branch-source:1772.va_69eda_d018d4 github-pullrequest:0.6.1 gradle:2.9 gson-api:2.10.1-15.v0d99f670e0a_7 handy-uri-templates-2-api:2.1.8-30.v7e777411b_148 htmlpublisher:1.32 instance-identity:185.v303dc7c645f9 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.16.1-373.ve709c6871598 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.9-1 jenkins-design-language:1.27.9 jjwt-api:0.11.5-77.v646c772fddb_0 joda-time-api:2.12.6-21.vca_fd74418fb_7 jquery3-api:3.7.1-1 json-path-api:2.9.0-33.v2527142f2e1d junit:1256.v002534a_5f33e ldap:711.vb_d1a_491714dc mailer:463.vedf8358e006b_ matrix-auth:3.2.1 matrix-project:822.824.v14451b_c0fd42 mina-sshd-api-common:2.12.0-90.v9f7fb_9fa_3d3b_ mina-sshd-api-core:2.12.0-90.v9f7fb_9fa_3d3b_ nodejs:1.6.1 okhttp-api:4.11.0-157.v6852a_a_fa_ec11 pam-auth:1.10 pipeline-build-step:540.vb_e8849e1a_b_d8 pipeline-github-lib:42.v0739460cda_c4 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:704.vc58b_8890a_384 pipeline-input-step:477.v339683a_8d55e pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2175.v76a_fff0a_2618 pipeline-model-definition:2.2175.v76a_fff0a_2618 pipeline-model-extensions:2.2175.v76a_fff0a_2618 pipeline-rest-api:2.34 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2175.v76a_fff0a_2618 pipeline-stage-view:2.34 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.8.0 pubsub-light:1.18 resource-disposer:0.23 scm-api:683.vb_16722fb_b_80b_ script-security:1313.v7a_6067dc7087 slack:684.v833089650554 snakeyaml-api:2.2-111.vc6598e30cc65 sse-gateway:1.26 ssh-credentials:308.ve4497b_ccd8f4 ssh-slaves:2.948.vb_8050d697fec sshd:3.322.v159e91f6a_550 structs:337.v1b_04ea_4df7c8 timestamper:1.26 token-macro:400.v35420b_922dcb_ trilead-api:2.133.vfb_8a_7b_9c5dd1 variant:60.v7290fc0eb_b_cd workflow-aggregator:596.v8c21c963d92d workflow-api:1289.va_cf779f32df0 workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3853.vb_a_490d892963 workflow-durable-task-step:1317.v5337e0c1fe28 workflow-job:1385.vb_58b_86ea_fff1 workflow-multibranch:773.vc4fe1378f1d5 workflow-scm-step:415.v434365564324 workflow-step-api:657.v03b_e8115821b_ workflow-support:865.v43e78cc44e0d ws-cleanup:0.45

What Operating System are you using (both controller, and any agents involved in the problem)?

MacOS

Reproduction steps

During Slack plugin configuration i got a Failure in testing connection

Expected Results

Test Connection feature should give SUCCESS result

Actual Results

Test Connection feature gave FAILURE result

Anything else?

Environment has been set according to guide Lines

Are you interested in contributing a fix?

No response

timja commented 3 months ago

How have you configured it? which guidelines did you follow?

Have you configured a bot application? what errors are in the system log?

asaltari commented 3 months ago

Dear @timja I followed the instruction from https://my.slack.com/services/new/jenkins-ci even if the guide is related to plugin v2.8. Infact i didn't find for example "Team Subdomain" field in the Slack Plugin configuration section. No, I don't have a bot application. Is it necessary? My purpose is to send messages to a Slack #channel I report below my system logs Mar 20, 2024 9:03:25 AM FINE jenkins.plugins.slack.StandardSlackService Posting: to #mobile-testing on jenkins-slack-plugin: {"attachments":[{"fallback":"Slack/Jenkins plugin: you're all set on http://localhost:8080/","color":"good","fields":[{"short":false,"value":"Slack/Jenkins plugin: you're all set on http://localhost:8080/"}],"mrkdwn_in":["pretext","text","fields"]}],"link_names":"1","unfurl_links":"true","unfurl_media":"true","channel":"#mobile-testing","as_user":"true"} Mar 20, 2024 9:03:26 AM WARNING jenkins.plugins.slack.StandardSlackService postToSlack Slack post may have failed. Response: null Mar 20, 2024 9:03:26 AM WARNING jenkins.plugins.slack.StandardSlackService postToSlack Response Code: 404

asaltari commented 3 months ago

Dear @timja After spent a couple of days I solved the issue by overriding the global configuration (that seems to be not working if you are using the test connection button) with the pipeline command `slackSend channel: '#mychannel', failOnError: true, message: 'Hello Guys', tokenCredentialId: 'your credential', teamDomain : 'yourteamDomain'

timja commented 3 months ago

I wouldn't recommend following the slack guide, I think its out of date.

This is the recommended guide: https://github.com/jenkinsci/slack-plugin#bot-user-mode

dmastrop commented 2 months ago

hi @asaltari I am seeing a very similar issue. The slack notifications from the jenkins post pipeline block were working fine through last night but today a very similar issue to what you are seeing. These were with live pipeline connections but I then went into the Test connection and it was failing.

Here are the error logs.(note: i removed my domain for security)

Apr 30, 2024 11:08:32 PM FINE jenkins.plugins.slack.StandardSlackService Posting: to devop23 on devops2-co: {"attachments":[{"fallback":"Slack/Jenkins plugin: you're all set on http://jenkins.***********.com:8080/","color":"good","fields":[{"short":false,"value":"Slack/Jenkins plugin: you're all set on http://jenkins.**********.com:8080/"}],"mrkdwn_in":["pretext","text","fields"]}],"link_names":"1","unfurl_links":"true","unfurl_media":"true","channel":"devop23","as_user":"true"} Apr 30, 2024 11:08:32 PM WARNING jenkins.plugins.slack.StandardSlackService postToSlack Slack post may have failed. Response: null Apr 30, 2024 11:08:32 PM WARNING jenkins.plugins.slack.StandardSlackService postToSlack Response Code: 404

I tried everything to get this back up both in real environment and on test connection. I created a new workspace, new channels, new tokens, removed the plugin and added it back in, etc.

The plugin is this one https://plugins.jenkins.io/slack/ "Slack Notification" Version: 684.v833089650554

I am running Jenkins server on an ubuntu22 EC2 instance in AWS. Version 2.440.3 very close to your version

openjdk 11.0.22 2024-01-16 OpenJDK Runtime Environment (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1) OpenJDK 64-Bit Server VM (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1, mixed mode, sharing)

I don't know why it spontaneously stopped working across all my pipelines. It was working very well prior to that with multiple pipelines and multiple pipeline runs....


**I tried adding the failOnError: true to bypass test connection and in my slackSend channel and got this exception.

Slack Send Pipeline step running, values are - baseUrl: , teamDomain: devops2-co, channel: #devop23, color: good, botUser: false, tokenCredentialId: slacktoken6, notifyCommitters: false, iconEmoji: , username: , timestamp: Error when executing always post condition: Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: b41321db-8b52-4d5e-9f81-b76a905834d0 hudson.AbortException: Slack notification failed. See Jenkins logs for details. at jenkins.plugins.slack.workflow.SlackSendStep$SlackSendStepExecution.run(SlackSendStep.java:386) at jenkins.plugins.slack.workflow.SlackSendStep$SlackSendStepExecution.run(SlackSendStep.java:258) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

Here are the jenkins logs (same error as before and i have FINEST logging enabled)

May 01, 2024 2:27:29 AM FINE jenkins.plugins.slack.StandardSlackService Posting: to #devop23 on devops2-co: {"attachments":[{"fallback":"SUCCESS: Job vprofile-project18-CICD-pipeline-cd-ansible-branch-2 build 58 \n More info at: http://jenkins.*************.com:8080/job/vprofile-project18-CICD-pipeline-cd-ansible-branch-2/58/","color":"good","fields":[{"short":false,"value":"*SUCCESS:* Job vprofile-project18-CICD-pipeline-cd-ansible-branch-2 build 58 \n More info at: http://jenkins.*************.com:8080/job/vprofile-project18-CICD-pipeline-cd-ansible-branch-2/58/"}],"mrkdwn_in":["pretext","text","fields"]}],"link_names":"1","unfurl_links":"true","unfurl_media":"true","channel":"#devop23","as_user":"true"} May 01, 2024 2:27:30 AM WARNING jenkins.plugins.slack.StandardSlackService postToSlack Slack post may have failed. Response: null May 01, 2024 2:27:30 AM WARNING jenkins.plugins.slack.StandardSlackService postToSlack Response Code: 404


Very strange. I even substituted incorrect channel and workspace names in the System Slack configuration in Jenkins, and it still shows the 404 Only one change made a difference, adding a FQDN for the workspace in the Jenkins workspace name. That caused a java exception since it should just be the host portion of the workspace URL.


I also did all of the standard troubleshooting listed below but none of these either applied to my case or helped Troubleshooting connection failure When testing the connection, you may see errors like:

WARNING j.p.slack.StandardSlackService#publish: Response Code: 404

There's a couple of things to try:

Have you enabled bot user mode? If you've ticked Custom slack app bot user then try unticking it, that mode is for when you've created a custom app and installed it to your workspace instead of the default Jenkins app made by Slack

Have you set the override URL? If you've entered something into Override url then try clearing it out, that field is only needed for slack compatible apps like mattermost.


warm regards Dave

ryanrupp commented 2 months ago

@dmastrop had this stop working for us today too ~1:15PM US Central time - found this thread. Haven't had a chance to look into it more yet but will look more tomorrow.

jwu910 commented 2 months ago

Just seeing this error today as well. Noticed around 4:30PM US Pacific time. Didn't see any issues with slack api status and none of our configs have changed in the last week.

dmastrop commented 2 months ago

@dmastrop had this stop working for us today too ~1:15PM US Central time - found this thread. Haven't had a chance to look into it more yet but will look more tomorrow.

Thanks. I tried inserting the failOnError: true and in my case it did not help and i got a java exception (added to my original comment) I checked slackstatus at their website and they were showing green but now have flagged some custom configs as failing I noticed it since late in the morning, but it was running great last night through 10pm PST.

https://slack-status.com/ Some users may be experiencing issues with custom integrations within Slack. We're investigating and will let you know as soon as we know more. We appreciate your patience in the meantime.

Apr 30, 7:14 PM PDT

dmastrop commented 2 months ago

It started working now. It is about 9.30pm PST i noticed on the lastest pipeline run.

timja commented 2 months ago

For anyone in future I really recommend going the custom app approach aka bot user mode.

the default is a legacy integration written directly in slacks codebase not using their new app framework and has some limitations