Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-62798

WEBhook return error 400 when trigered from push

    XMLWordPrintable

Details

    • 2.1.3

    Description

      Hi

      I try to integrate Jennkins and Bitbucket server with "Bitbucket Server Integration" plugin. I configure personal access token and after pipeline job creation webhook is created in Bitbucket server. Git access is working and status from Jenkins job is presented in Bitbucket server.

      The problem that I have is with triggering Jenkins job on git push. I receive this error in Bitbucket WEBhook:

       

       

      Date: Wed, 24 Jun 2020 07:40:05 GMT
      Server: Jetty(9.4.27.v20200227)
      X-Content-Type-Options: nosniff
      Cache-Control: must-revalidate,no-cache,no-store
      Content-Type: text/html; charset=ISO-8859-1
      Via: 1.1 localhost (Apache-HttpClient/4.5.5 (cache))
      Content-Length: 1468
      Body
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
      <title>Error 400 Failed to parse the body: Cannot construct instance of `com.atlassian.bitbucket.jenkins.internal.model.BitbucketUser`, problem: emailAddress
       at [Source: (org.eclipse.jetty.server.HttpInputOverHTTP); line: 1, column: 311] (through reference chain: com.atlassian.bitbucket.jenkins.internal.trigger.RefsChangedWebhookEvent[&quot;actor&quot;])</title>
      </head>
      

       

      and this error in Jenkins log:

      PM SCHWERWIEGEND com.atlassian.bitbucket.jenkins.internal.trigger.BitbucketWebhookEndpoint parseFailed to parse the body: Cannot construct instance of `com.atlassian.bitbucket.jenkins.internal.model.BitbucketUser`, problem: emailAddress
       at [Source: (org.eclipse.jetty.server.HttpInputOverHTTP); line: 1, column: 311] (through reference chain: com.atlassian.bitbucket.jenkins.internal.trigger.RefsChangedWebhookEvent["actor"])
      

       

      Attachments

        Activity

          Now I realize that I push to Bitbucket server using ssh key assigned to the repository.

          In "Push log" I see this:

          when push using ssh key:

          Pushed by -> Access Key User

           

          when push using user name and password:

          pushed by -> Kanchev, Nikolay (my Bitbucket server user)

           

          Perhaps this is the problem - repository assigned keys don't have users connected with them.

          In some cases we use repository assigned keys to push changes is there a way to solve this problem?

           

          Best Regards

          Nikolay

          niki_kan Nikolay Kanchev added a comment - Now I realize that I push to Bitbucket server using ssh key assigned to the repository. In "Push log" I see this: when push using ssh key: Pushed by -> Access Key User   when push using user name and password: pushed by -> Kanchev, Nikolay (my Bitbucket server user)   Perhaps this is the problem - repository assigned keys don't have users connected with them. In some cases we use repository assigned keys to push changes is there a way to solve this problem?   Best Regards Nikolay

          I make some additional tests.

          I add ssh key to my user and push changes to Bitbucket server the results is the same as when I use repository assigned ssh key:

          In "Push log" I see this:

          Pushed by -> Access Key User

           

          And the Webhook return the same error for missing e-mail address.

          niki_kan Nikolay Kanchev added a comment - I make some additional tests. I add ssh key to my user and push changes to Bitbucket server the results is the same as when I use repository assigned ssh key: In "Push log" I see this: Pushed by -> Access Key User   And the Webhook return the same error for missing e-mail address.
          addamsson Adam Arold added a comment -

          Is there a solution for this problem? I'm also facing it right now.

          addamsson Adam Arold added a comment - Is there a solution for this problem? I'm also facing it right now.
          royxszhou2010 roy zhou added a comment -

          you can set up the ssh key at your Bitbucket user profile, so when u do the check in it will associate with your profile and use your email address in the webhook payload. i had the same issue and fix it this way.

          royxszhou2010 roy zhou added a comment - you can set up the ssh key at your Bitbucket user profile, so when u do the check in it will associate with your profile and use your email address in the webhook payload. i had the same issue and fix it this way.

          People

            mhenschke_atlassian Martin Henschke
            niki_kan Nikolay Kanchev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: