Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to send keep getting WebhookException: {"embeds": ["0"]} #36

Open
mightywomble opened this issue May 13, 2021 · 5 comments
Open
Labels
bug Something isn't working

Comments

@mightywomble
Copy link

Version report

Jenkins and plugins versions report:

Jenkins: 2.277.4
OS: Linux - 4.18.0-240.el8.x86_64
---
cloudbees-folder:6.15
trilead-api:1.0.13
antisamy-markup-formatter:2.1
structs:1.23
workflow-basic-steps:2.23
workflow-step-api:2.23
token-macro:2.15
build-timeout:1.20
git:4.7.1
jaxb:2.3.0.1
credentials:2.4
gradle:1.36
plain-credentials:1.7
pipeline-milestone-step:1.3.2
ssh-credentials:1.18.1
credentials-binding:1.24
jsch:0.1.55.2
scm-api:2.6.4
workflow-api:2.42
git-client:3.7.1
timestamper:1.13
script-security:1.76
pipeline-input-step:2.12
plugin-util-api:2.2.0
font-awesome-api:5.15.3-2
popper-api:1.16.1-2
git-server:1.9
jquery3-api:3.6.0-1
pipeline-stage-step:2.5
bootstrap4-api:4.6.0-3
pipeline-graph-analysis:1.10
snakeyaml-api:1.27.0
jackson2-api:2.12.3
branch-api:2.6.4
echarts-api:5.1.0-2
display-url-api:2.3.4
workflow-support:3.8
checks-api:1.7.0
junit:1.49
pipeline-rest-api:2.19
matrix-project:1.18
resource-disposer:0.15
ws-cleanup:0.39
github:1.33.1
ant:1.11
durable-task:1.36
jdk-tool:1.5
workflow-durable-task-step:2.38
handlebars:3.0.8
command-launcher:1.6
bouncycastle-api:2.20
jjwt-api:0.11.2-9.c8b45b8bb173
ace-editor:1.1
workflow-scm-step:2.12
workflow-cps:2.91
okhttp-api:3.14.9
workflow-job:2.40
mailer:1.34
momentjs:1.1.1
apache-httpcomponents-client-4-api:4.5.13-1.0
pipeline-stage-view:2.19
pipeline-build-step:2.13
pipeline-model-api:1.8.4
pipeline-model-extensions:1.8.4
workflow-cps-global-lib:2.19
workflow-multibranch:2.23
pipeline-stage-tags-metadata:1.8.4
pipeline-model-definition:1.8.4
lockable-resources:2.10
workflow-aggregator:2.6
github-api:1.123
github-branch-source:2.10.4
pipeline-github-lib:1.0
ssh-slaves:1.31.5
matrix-auth:2.6.6
pam-auth:1.6
ldap:2.6
email-ext:2.82
dashboard-view:2.16
caffeine-api:2.9.1-23.v51c4e2c879c8
configuration-as-code:1.51
ssh-agent:1.22
htmlpublisher:1.25
gitlab-plugin:1.5.20
emailext-template:1.2
publish-over:0.22
publish-over-ssh:1.22
ssh:2.6.1
ansible:1.1
discord-notifier:1.4.14
rocketchatnotifier:1.4.9

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

Reproduction steps

Within a declarative pipeline (webhook URL edited below) I've added this

    stage('Notify sucess') {
        steps{
        discordSend(description: "${currentBuild.currentResult}: Job ${env.JOB_NAME} \nBuild: ${env.BUILD_NUMBER} \nMore info at: \n${env.BUILD_URL}", footer: 'No-Code', unstable: true, link: env.BUILD_URL, result: "${currentBuild.currentResult}", title: "${JOB_NAME} << CLICK", webhookURL: 'https://discord.com/api/webhooks/842304094/yeoAn6A_9XY2O71dFbhlt9lUZrAW6OnFEG7y')
            }
    }

Even if i use something far similar

discordSend description: '', footer: '', image: '', link: 'env.BUILD_URL', result: '', thumbnail: '', title: 'MoveFiles', webhookURL: 'https://discord.com/api/webhooks/842304094/yeoAn6A_9XY2O71dFbhlt9lUZrAW6OnFEG7y'

Results

Expected result:

Message in discord

Actual result:

nz.co.jammehcow.jenkinsdiscord.exception.WebhookException: {"embeds": ["0"]}
at nz.co.jammehcow.jenkinsdiscord.DiscordWebhook.send(DiscordWebhook.java:212)
at nz.co.jammehcow.jenkinsdiscord.DiscordPipelineStep$DiscordPipelineStepExecution.run(DiscordPipelineStep.java:171)
at nz.co.jammehcow.jenkinsdiscord.DiscordPipelineStep$DiscordPipelineStepExecution.run(DiscordPipelineStep.java:132)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate2(ACL.java:449)
at hudson.security.ACL.impersonate(ACL.java:461)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
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)

@mightywomble mightywomble added the bug Something isn't working label May 13, 2021
@CptPlastic
Copy link

CptPlastic commented May 21, 2021

I don't think that's a bug. It sounds like you are missing something. If you are using a pipeline this works. Of course use your own webhook.

discordSend description: "Lua check for the win", footer: "This should be green, yellow means issues with the code, and red is just bad.", link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: 'https://discord.com/api/webhooks/YOURWEBHOOKHERE

@boristsr
Copy link

I get the same issue as soon as I tick "Enable URL Linking"
image

Notifications are sent as expected when this is unchecked.

nz.co.jammehcow.jenkinsdiscord.exception.WebhookException: {"embeds": ["0"]}
	at nz.co.jammehcow.jenkinsdiscord.DiscordWebhook.send(DiscordWebhook.java:212)
	at nz.co.jammehcow.jenkinsdiscord.WebhookPublisher.perform(WebhookPublisher.java:293)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
	at hudson.model.Build$BuildExecution.cleanUp(Build.java:187)
	at hudson.model.Run.execute(Run.java:1953)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)

I have set the URL in the global Jenkins settings.

image

@stijnb1234
Copy link

stijnb1234 commented Feb 27, 2023

Having the same problem. Did find a fix?

@ojalmeida
Copy link

I was having the same problem, the solution for me was set the Jenkins URL

via UI:

Manage Jenkins > System > Jenkins Location > Jenkins URL

image

via JCasC (Helm instalation):

set .controller.jenkinsUrl in values file

@TechnicJelle
Copy link

TechnicJelle commented Nov 27, 2024

I'm having the same issue:

********** STAGE COMMAND COMPLETED **********
BuildCookRun time: 238.17 s
BUILD SUCCESSFUL
AutomationTool executed for 0h 3m 58s
AutomationTool exiting with ExitCode=0 (Success)

Sending notification to Discord.
nz.co.jammehcow.jenkinsdiscord.exception.WebhookException: {
  "embeds": [
    "0"
  ]
}
	at PluginClassLoader for discord-notifier//nz.co.jammehcow.jenkinsdiscord.DiscordWebhook.send(DiscordWebhook.java:223)
	at PluginClassLoader for discord-notifier//nz.co.jammehcow.jenkinsdiscord.WebhookPublisher.perform(WebhookPublisher.java:340)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:818)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:767)
	at hudson.model.Build$BuildExecution.cleanUp(Build.java:189)
	at hudson.model.Run.execute(Run.java:1874)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:445)

Finished: SUCCESS

The URL is properly set in the global Jenkins settings:
Image
(It's a direct Tailscale URL, so it doesn't have a TLD. The people in the Discord I'm sending this to, all have Tailscale set up, so clicking the link won't cause any issues for them.)

These are my plugin settings:

Image

But if I disable URL linking, it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants