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

gitlab webhook has JSON parse error #1027

Closed
cel533 opened this Issue May 29, 2018 · 9 comments

Comments

Projects
None yet
7 participants
@cel533

cel533 commented May 29, 2018

Repositories: https://github.com/cel533/bustest

Manual test

curl -H "Content-Type:application/json" -X POST --data '{"project":{}}' "http://192.168.1.158:8700/actuator/bus-refresh"

result:

{"timestamp":"2018-05-29T09:08:04.890+0000","status":400,"error":"Bad Request","message":"JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token\n at [Source: (PushbackInputStream); line: 1, column: 12] (through reference chain: java.util.LinkedHashMap[\"project\"])","path":"/actuator/bus-refresh"}

i use GitLab Community Edition 10.5.3

Request URL: POST http://192.168.1.158:8707/actuator/bus-refresh 400

Trigger: Push Hook

Elapsed time: 0.18 sec

Response body:
{"timestamp":"2018-05-29T08:27:58.076+0000","status":400,"error":"Bad Request","message":"JSON parse error: Cannot deserialize instance of java.lang.Stringout of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance ofjava.lang.Stringout of START_OBJECT token\n at [Source: (PushbackInputStream); line: 1, column: 462] (through reference chain: java.util.LinkedHashMap[\"project\"])","path":"/actuator/bus-refresh"}
Request headers:

Content-Type: application/json
X-Gitlab-Event: Push Hook

Request body:

{
  "object_kind": "push",
  "event_name": "push",
  "before": "21ea24c121ff779bf9b1b089bbe35da84b6006d9",
  "after": "c07d1b3abc3c57f88b2ebbae3305339303bb4c3c",
  "ref": "refs/heads/master",
  "checkout_sha": "c07d1b3abc3c57f88b2ebbae3305339303bb4c3c",
  "message": null,
  "user_id": 4,
  "user_name": "configAdmin",
  "user_username": "configAdmin",
  "user_email": "1@1.1",
  "user_avatar": "https://www.gravatar.com/avatar/1788b7db4306d24f66ea6258e76ad30d?s=80&d=identicon",
  "project_id": 6,
  "project": {
    "id": 6,
    "name": "ssa-cloud-config",
    "description": "",
    "web_url": "http://gitlab.example.com/configGroup/ssa-cloud-config",
    "avatar_url": null,
    "git_ssh_url": "git@gitlab.example.com:configGroup/ssa-cloud-config.git",
    "git_http_url": "http://gitlab.example.com/configGroup/ssa-cloud-config.git",
    "namespace": "configGroup",
    "visibility_level": 10,
    "path_with_namespace": "configGroup/ssa-cloud-config",
    "default_branch": "master",
    "ci_config_path": null,
    "homepage": "http://gitlab.example.com/configGroup/ssa-cloud-config",
    "url": "git@gitlab.example.com:configGroup/ssa-cloud-config.git",
    "ssh_url": "git@gitlab.example.com:configGroup/ssa-cloud-config.git",
    "http_url": "http://gitlab.example.com/configGroup/ssa-cloud-config.git"
  },
  "commits": [
    {
      "id": "c07d1b3abc3c57f88b2ebbae3305339303bb4c3c",
      "message": "Update common-dev.yml",
      "timestamp": "2018-05-29T05:11:32+00:00",
      "url": "http://gitlab.example.com/configGroup/ssa-cloud-config/commit/c07d1b3abc3c57f88b2ebbae3305339303bb4c3c",
      "author": {
        "name": "configAdmin",
        "email": "1@1.1"
      },
      "added": [

      ],
      "modified": [
        "auth/common-dev.yml"
      ],
      "removed": [

      ]
    },
    {
      "id": "9efa34b3076f6db74621e6a41d63a08cb8c40d74",
      "message": "Upload New File",
      "timestamp": "2018-05-29T05:11:12+00:00",
      "url": "http://gitlab.example.com/configGroup/ssa-cloud-config/commit/9efa34b3076f6db74621e6a41d63a08cb8c40d74",
      "author": {
        "name": "configAdmin",
        "email": "1@1.1"
      },
      "added": [
        "auth/gateway-dev.yml"
      ],
      "modified": [

      ],
      "removed": [

      ]
    },
    {
      "id": "21ea24c121ff779bf9b1b089bbe35da84b6006d9",
      "message": "Upload New File",
      "timestamp": "2018-05-29T05:10:52+00:00",
      "url": "http://gitlab.example.com/configGroup/ssa-cloud-config/commit/21ea24c121ff779bf9b1b089bbe35da84b6006d9",
      "author": {
        "name": "configAdmin",
        "email": "1@1.1"
      },
      "added": [
        "auth/commonservice-dev.yml"
      ],
      "modified": [

      ],
      "removed": [

      ]
    }
  ],
  "total_commits_count": 3,
  "repository": {
    "name": "ssa-cloud-config",
    "url": "git@gitlab.example.com:configGroup/ssa-cloud-config.git",
    "description": "",
    "homepage": "http://gitlab.example.com/configGroup/ssa-cloud-config",
    "git_http_url": "http://gitlab.example.com/configGroup/ssa-cloud-config.git",
    "git_ssh_url": "git@gitlab.example.com:configGroup/ssa-cloud-config.git",
    "visibility_level": 10
  }
}

POM

 <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId> spring-cloud-config-monitor</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
        </dependency>
<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
    </parent>

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Finchley.RC1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
@hewenjian123

This comment has been minimized.

hewenjian123 commented Jun 14, 2018

github webhook also has JSON parse error

@marcingrzejszczak

This comment has been minimized.

Contributor

marcingrzejszczak commented Jul 13, 2018

Is the issue still present in Finchley.RELEASE?

@zhoujinbin

This comment has been minimized.

zhoujinbin commented Jul 20, 2018

@marcingrzejszczak I also had this problem with Finchley.RELEASE.

@check321

This comment has been minimized.

check321 commented Jul 21, 2018

this error still occurs in Finchley.RELEASE.

@ryanjbaxter

This comment has been minimized.

Contributor

ryanjbaxter commented Jul 24, 2018

@cel533 your project is to complex to run
@hewenjian123 @zhoujinbin @check321 can any of you provide a simple project that reproduces the problem?

@liuzhp2013

This comment has been minimized.

liuzhp2013 commented Aug 1, 2018

image
image

Finchley.RELEASE. still has this error

@check321

This comment has been minimized.

check321 commented Aug 1, 2018

@ryanjbaxter

  • Here is my config server sample.
  • webhook config as shown below. PayLoad URL is the config server url.
    image
@ryanjbaxter

This comment has been minimized.

Contributor

ryanjbaxter commented Aug 6, 2018

You should not be sending webhooks to /bus-refresh it should be sent to /monitor
http://cloud.spring.io/spring-cloud-static/Finchley.SR1/single/spring-cloud.html#_push_notifications_and_spring_cloud_bus

@check321

This comment has been minimized.

check321 commented Aug 8, 2018

@ryanjbaxter
thx, It works when I changed the url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment