btey / openproject-gitlab-integration

OpenProject module for integration with Gitlab
GNU General Public License v3.0
84 stars 18 forks source link

Webhook invoked, but no data in openproject #28

Closed wagner-petrosoft closed 1 year ago

wagner-petrosoft commented 1 year ago

Hello. We just build a docker image following the readme file and get gitlab tab work in open project's work packages.

After that, we creat a user capable of write comments in the work packages. Generate a token and configure the web hook in our gitlab instance.

But after this, the webhook got a 200 respone, but no data is shown on the work packages. I get this logs from openproject instance. Is expected the redirect to login page?

I, [2023-01-18T18:38:18.796510 #70]  INFO -- : Started GET "/webhooks/gitlab?key=ae278268" for 10.255.0.3 at 2023-01-18 18:38:18 +0000
I, [2023-01-18T18:38:18.802790 #70]  INFO -- : Processing by Webhooks::Incoming::HooksController#handle_hook as */*
I, [2023-01-18T18:38:18.804101 #70]  INFO -- :   Parameters: {"object_kind"=>"note", "event_type"=>"note", "user"=>{"id"=>14, "name"=>.........(lots os data)
I, [2023-01-18T18:38:18.817280 #70]  INFO -- : Redirected to https://openproject.mydomain/login?back_url=https%3A%2F%2Fopenproject.mydomain%2Fwebhooks%2Fgitlab
I, [2023-01-18T18:38:18.817441 #70]  INFO -- : Filter chain halted as :check_if_login_required rendered or redirected
I, [2023-01-18T18:38:18.817618 #70]  INFO -- : Completed 302 Found in 13ms (ActiveRecord: 3.8ms | Allocations: 1805)
I, [2023-01-18T18:38:18.830657 #70]  INFO -- : Started GET "/login?back_url=https%3A%2F%2Fopenproject.mydomain%2Fwebhooks%2Fgitlab" for 10.255.0.3 at 2023-01-18 18:38:18 +0000
I, [2023-01-18T18:38:18.834390 #70]  INFO -- : Processing by AccountController#login as */*
I, [2023-01-18T18:38:18.834950 #70]  INFO -- :   Parameters: {"object_kind"=>"note", "event_type"=>"note", "user"=>{"id"=>14, "name"=>"Wagner Reck", "username"=>(lots os data)
I, [2023-01-18T18:38:18.852999 #70]  INFO -- :   Rendered account/login.html.erb within layouts/no_menu (Duration: 13.2ms | Allocations: 5442)
I, [2023-01-18T18:38:18.872855 #70]  INFO -- :   Rendered layouts/base.html.erb (Duration: 19.7ms | Allocations: 8527)
I, [2023-01-18T18:38:18.873523 #70]  INFO -- :   Rendered layout layouts/no_menu.html.erb (Duration: 33.7ms | Allocations: 14057)
I, [2023-01-18T18:38:18.873786 #70]  INFO -- : Completed 200 OK in 39ms (Views: 31.2ms | ActiveRecord: 4.1ms | Allocations: 15404)

The Parameters contain the following Open project tag: "title"=>"Draft: Aplicacao de novo tema OP#91"

this is the empty Gitlab tab image

Gitlab version: 15.6.2-ee Open project: 12.4.2 both using ldap to login. Gitlab-bot was created as a local user.

Thanks in advance.

btey commented 1 year ago

Hello @wagner-petrosoft

The redirect to the login page is expected if the token (or user) could not be validated. Recreate the token for the Gitlab-bot user in OpenProject and use the new one in Gitlab. The log shows a very short token string in the url:

Started GET "/webhooks/gitlab?key=ae278268" for 10.255.0.3

Regards, Ben

wagner-petrosoft commented 1 year ago

Hello, it's working now. I put the same token from the readme, not the access token. If i put the user token, the test button on gitlab gives a 500 error.

I will send a PR with a change in Readme to aware other users. Thanks for your attention!

Wagner Reck