self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

Gitlab integration problem

Open victorelec14 opened this issue 2 years ago • 8 comments

Self-Hosted Version

22.8.0 f85b134

CPU Architecture

x86_64

Docker Version

20.10.12

Docker Compose Version

1.29.2

Steps to Reproduce

  1. Add new gitlab Integration

https://sentry.xxxxxxx/organizations/victorelec14/integrations/gitlab/setup/?

  1. Click "Next" It go to "https://sentry.xxxxxx/organizations/victorelec14/integrations/gitlab/setup/sentryxxxxxx/extensions/gitlab/setup/?completed_installation_guide" image

The problem started when I had sentry on the same server as gitlab and then moved gitlab and sentry to other servers.

I already tried to eliminate all the connections and integrations that had the previous local IP, now the form does not ask for the gitlab url, is it as if it were in the cache?

thanks

Expected Result

it should show the form to put the gitlab tokens, as in the image

image

Actual Result

404 Page Not Found The page you are looking for was not found.

victorelec14 avatar Aug 30 '22 08:08 victorelec14

Just to confirm, it is reaching the page .../integrations/gitlab/setup/sentryxxxxxx/extensions/gitlab/setup/?completed_installation_guide, which returns a 404 error? I'm able to see the form for gitlab configuration for my setup on the same route.

Are you using chrome? Can you go to developer tools and check the network tab to see if there's more information about the error there?

hubertdeng123 avatar Aug 30 '22 19:08 hubertdeng123

Just to confirm, it is reaching the page .../integrations/gitlab/setup/sentryxxxxxx/extensions/gitlab/setup/?completed_installation_guide, which returns a 404 error? I'm able to see the form for gitlab configuration for my setup on the same route.

Are you using chrome? Can you go to developer tools and check the network tab to see if there's more information about the error there?

@hubertdeng123 Yes in that url and it's strange because I remember that in some versions back he saw the form and put the data there, then I changed the gitlab and the sentry to a VPS (which can be accessed externally) and there it stopped working because of the old urls, I updated Sentry to 20.01 (i seems) and it didn't work anymore for what I thought was a bug, now I updated to 21.08 and it's still the same

I'm using Brave "Version 1.43.79 Chromium: 104.0.5112.102 (Official Build) beta (64-bit) "

image

image

image

I am the url responds with a 200 and puts that message in "preview", in brave I have the shields (ad blockers) disabled and it gives the same error, I am going to try with another browser.

 Please wait while we load an obnoxious amount of JavaScript.

You may need to disable adblocking extensions to load Sentry.

image

Thank you

PS:

In Edge the same thing happens, like it doesn't want to load the javascript and it says that maybe I have a blocker activated.

victorelec14 avatar Aug 31 '22 06:08 victorelec14

Not quite sure why the next button is redirecting you to https://sentry.xxxxxx/organizations/victorelec14/integrations/gitlab/setup/sentryxxxxxx/extensions/gitlab/setup/?completed_installation_guide that route might be invalid actually. I misread and actually I'm getting redirected to another page.

Can you try accessing the route https://sentry.xxxxxx/extensions/gitlab/setup/?completed_installation_guide? That's the one I'm seeing.

hubertdeng123 avatar Aug 31 '22 19:08 hubertdeng123

Not quite sure why the next button is redirecting you to https://sentry.xxxxxx/organizations/victorelec14/integrations/gitlab/setup/sentryxxxxxx/extensions/gitlab/setup/?completed_installation_guide that route might be invalid actually. I misread and actually I'm getting redirected to another page.

Can you try accessing the route https://sentry.xxxxxx/extensions/gitlab/setup/?completed_installation_guide? That's the one I'm seeing.

@hubertdeng123 now if I see the form with that URL that you sent me, but looking at the code of the button the URL is in the href fine but then there is an After that modifies that URL and puts it wrong, by putting the mouse over it you get to see what url is the one that takes now.

I'm going to fill in the form data and see if it saves correctly.

Thank you !

https://sentry.xxxxxxxx/organizations/xxxxx/integrations/gitlab/setup/? image

image

victorelec14 avatar Sep 01 '22 06:09 victorelec14

It seems to me that here is the problem? It is missing the slash from the beginning to the url of next.

thanks

https://github.com/getsentry/sentry/blob/master/src/sentry/integrations/gitlab/integration.py#L260

victorelec14 avatar Sep 01 '22 06:09 victorelec14

Awesome, that is great to hear that you're able to access the page. Just to confirm, was the form data able to be saved successfully? If there is a routing issue here it will be redirected to the appropriate team.

hubertdeng123 avatar Sep 01 '22 17:09 hubertdeng123

@hubertdeng123 I tried to create the connection but something gives an error, I don't know if the url is being generated wrong again.

I get this error in Gitlab:

in the redirect_uri it seems that it puts the sentry url twice, I think it's almost the same problem?

https://gitlab.xxxxxxxxx/oauth/authorize?client_id=f1555a75544602da9f2d151bb82688643a276ef72732xxxxxxxxxxxxxxxx&response_type=code&scope=api&state=ea2701969ea04d0e9bxxxxxxxxxxx&redirect_uri=sentryxxxxxxxxx%2Fsentry.xxxxxxxx%2Fextensions%2Fgitlab%2Fsetup%2F

image

Thanks

victorelec14 avatar Sep 02 '22 06:09 victorelec14

It seems like the PR you put up in the main sentry repo is not yet merged, will check in again once that is done.

hubertdeng123 avatar Sep 06 '22 16:09 hubertdeng123

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Sep 28 '22 00:09 github-actions[bot]

Activity to not automatically close the ticket :)

victorelec14 avatar Sep 28 '22 06:09 victorelec14

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Oct 20 '22 00:10 github-actions[bot]

Hi,

I just updated to version v22.10.0 but the problem persists.

At the beginning of the installation, the next button takes you to another url (that is broken) and not to the url of the next step, which is to give the gitlab data.

the link is changed by after loading

image

If I go to the url directly if I have the form:

https://sentry.taracloud.de/extensions/gitlab/setup/?completed_installation_guide

image

The PR was merged but is it within version v22.10.0 ? i think yes, this ist in master (25 days ago) and v22.10.0 was released 6 days ago.

https://github.com/getsentry/sentry/pull/38377

Thanks

victorelec14 avatar Oct 24 '22 08:10 victorelec14

Hi @hubertdeng123 @ethanhs @armenzg @ryan953

The problem persists on:

Sentry 23.1.1
Gitlab 15.8.1

Could the problem be that I delete an old Instance and try to add it again? Maybe not all the data was deleted and sentry thinks that an instance is already configured, that's why it sends me directly to the end of the tour and not to the next step?

Thanks

victorelec14 avatar Feb 14 '23 09:02 victorelec14

Hey there @victorelec14, were you able to figure this out? Sorry it fell through the cracks.

At the beginning of the installation, the next button takes you to another url (that is broken) and not to the url of the next step, which is to give the gitlab data.

What broken url is this?

hubertdeng123 avatar Jul 19 '23 17:07 hubertdeng123

Hey there @victorelec14, were you able to figure this out? Sorry it fell through the cracks.

At the beginning of the installation, the next button takes you to another url (that is broken) and not to the url of the next step, which is to give the gitlab data.

What broken url is this?

The problem persists, I'm going to try to try the new version of Sentry these days and I'll tell you how it goes.

The url are the ones I put in the Post above, in theory I should follow the "tour" but in my case the next button takes me to the end of everything, as if I were ignoring the other steps.

https://sentry.xxxxxx/organizations/victorelec14/integrations/gitlab/setup/sentryxxxxxx/extensions/gitlab/setup/?completed_installation_guide

A part of the JS changes the url, because the code is displayed with the organization and when you mouse over it shows you a different URL: web/extensions/extensions/gitlab/setup/?completed_installation_guide -- and not-- web/organizations/victorelec14/integrations/gitlab/setup/?completed_installation_guide

image

Thanks.

victorelec14 avatar Jul 19 '23 21:07 victorelec14

The url are the ones I put in the Post above, in theory I should follow the "tour" but in my case the next button takes me to the end of everything, as if I were ignoring the other steps.

I just clicked through on a clean install and it works for me. This may be due to what you have mentioned previously, where maybe not all data is deleted. Perhaps you can check your postgres database tables sentry_integration, sentry_integrationfeature, and sentry_integrationexternalproject to see if you can wipe anything related to gitlab? Otherwise not sure what else may be causing this

hubertdeng123 avatar Jul 19 '23 22:07 hubertdeng123

@hubertdeng123 I just updated to version v23.7.0 and the problem continues.

in Sentry it shows as the integration is not installed (see video).

How do I see the data in the database? I use docker.

Thank you

https://github.com/getsentry/self-hosted/assets/543450/c3aac3b5-53c9-4228-b65f-c4edf2057d65

victorelec14 avatar Jul 21 '23 10:07 victorelec14

You can see the database with

docker compose exec postgres bash
psql -U postgres

Then, you can perform SELECT statements to see rows in the tables. Something like

SELECT * from sentry_integration;

hubertdeng123 avatar Jul 24 '23 17:07 hubertdeng123

@hubertdeng123 I just see the table and I have 3 repositories that I change at long time ago.

first we had the local Gitlab by IP and then we changed it to a subdomain.

Is it safe to delete the records directly or are there relationships?

postgres=# SELECT * from sentry_integration;

id provider external_id name metadata status date_added date_updated
1 gitlab 192.168.1.20:3000:11 AAA1 {"base_url": "http://192.168.1.20:3000", "instance": "192.168.1.20:3000", "verify_ssl": false, "scopes": ["api"], "include_subgroups": true, "group_id": 11, "webhook_secret": "04dxxxxxxxxxexxxxxxxxxxxxxxxx", "domain_name": "192.168.1.20:3000/aaa1", "icon": null} 0 2020-03-17 12:41:23.293612+00 2021-11-16 16:13:08.814729+00
2 gitlab 192.168.1.20:3000:20 BBB2 {"base_url": "http://192.168.1.20:3000", "instance": "192.168.1.20:3000", "verify_ssl": true, "scopes": ["api"], "include_subgroups": false, "group_id": 20, "webhook_secret": "2116xxxxxxxxxxxxxxxxxxxxxxx", "domain_name": "192.168.1.20:3000/bbb2", "icon": null} 0 2021-07-05 09:36:29.821623+00 2021-11-16 16:13:08.814729+00
3 gitlab gitlab.test.net:3000:20 CCC3 {"base_url": "http://gitlab.test.net:3000", "instance": "gitlab.test.net:3000", "verify_ssl": true, "scopes": ["api"], "include_subgroups": false, "group_id": 20, "webhook_secret": "7ddxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "domain_name": "gitlab.test.net:3000/ccc3", "icon": null} 0 2021-07-14 08:20:38.094663+00 2021-11-16 16:13:08.814729+00

Thanks

victorelec14 avatar Jul 26 '23 08:07 victorelec14

Is it safe to delete the records directly or are there relationships? These should be safe to delete (famous last words). Hopefully after these are gone the integration setup will ask for gitlab url.

hubertdeng123 avatar Aug 02 '23 00:08 hubertdeng123

@hubertdeng123 I just did the test and the problem continues.

~~Could it be related that I use NginxProxyManager as a reverse proxy?~~ (PS: I tried port 9000 from the host and it's the same )

I don't know what else it could be :/

Thank you.

image

Some extra info:

postgres=# SELECT count(*) from django_migrations;
 count
-------
   554
postgres=# SELECT datname FROM pg_catalog.pg_database;
datname
template0
template1
postgres
postgres=# SELECT * from sentry_integrationfeature;
id user_description feature date_added target_id target_type
1 0 2021-07-14 08:34:53.979264+00 1 0
postgres=# \dt+
Schema Name Type Owner Persistence Access method Size Description
public auth_authenticator table postgres permanent heap 16 kB
public auth_group table postgres permanent heap 0 bytes
public auth_group_permissions table postgres permanent heap 0 bytes
public auth_permission table postgres permanent heap 104 kB
public auth_user table postgres permanent heap 56 kB
public django_admin_log table postgres permanent heap 16 kB
public django_content_type table postgres permanent heap 40 kB
public django_migrations table postgres permanent heap 80 kB
public django_session table postgres permanent heap 8192 bytes
public django_site table postgres permanent heap 8192 bytes
public nodestore_node table postgres permanent heap 12 GB
public replays_replayrecordingsegment table postgres permanent heap 0 bytes
public sentry_activity table postgres permanent heap 72 kB
public sentry_actor table postgres permanent heap 8192 bytes
public sentry_alertrule table postgres permanent heap 16 kB
public sentry_alertruleactivity table postgres permanent heap 8192 bytes
public sentry_alertruleexcludedprojects table postgres permanent heap 0 bytes
public sentry_alertruletrigger table postgres permanent heap 16 kB
public sentry_alertruletriggeraction table postgres permanent heap 16 kB
public sentry_alertruletriggerexclusion table postgres permanent heap 0 bytes
public sentry_apiapplication table postgres permanent heap 16 kB
public sentry_apiauthorization table postgres permanent heap 8192 bytes
public sentry_apigrant table postgres permanent heap 16 kB
public sentry_apikey table postgres permanent heap 8192 bytes
public sentry_apitoken table postgres permanent heap 16 kB
public sentry_appconnectbuild table postgres permanent heap 8192 bytes
public sentry_artifactbundle table postgres permanent heap 0 bytes
public sentry_artifactbundleflatfileindex table postgres permanent heap 0 bytes
public sentry_artifactbundleindex table postgres permanent heap 8192 bytes
public sentry_assistant_activity table postgres permanent heap 8192 bytes
public sentry_auditlogentry table postgres permanent heap 56 kB
public sentry_authidentity table postgres permanent heap 8192 bytes
public sentry_authprovider table postgres permanent heap 8192 bytes
public sentry_authprovider_default_teams table postgres permanent heap 0 bytes
public sentry_broadcast table postgres permanent heap 8192 bytes
public sentry_broadcastseen table postgres permanent heap 0 bytes
public sentry_commit table postgres permanent heap 8192 bytes
public sentry_commitauthor table postgres permanent heap 0 bytes
public sentry_commitfilechange table postgres permanent heap 8192 bytes
public sentry_controlfile table postgres permanent heap 8192 bytes
public sentry_controlfileblob table postgres permanent heap 8192 bytes
public sentry_controlfileblobindex table postgres permanent heap 0 bytes
public sentry_controlfileblobowner table postgres permanent heap 0 bytes
public sentry_controloption table postgres permanent heap 8192 bytes
public sentry_controloutbox table postgres permanent heap 32 kB
public sentry_controltombstone table postgres permanent heap 0 bytes
public sentry_dashboard table postgres permanent heap 48 kB
public sentry_dashboardproject table postgres permanent heap 0 bytes
public sentry_dashboardtombstone table postgres permanent heap 0 bytes
public sentry_dashboardwidget table postgres permanent heap 56 kB
public sentry_dashboardwidgetquery table postgres permanent heap 64 kB
public sentry_debugidartifactbundle table postgres permanent heap 0 bytes
public sentry_deletedorganization table postgres permanent heap 8192 bytes
public sentry_deletedproject table postgres permanent heap 8192 bytes
public sentry_deletedteam table postgres permanent heap 8192 bytes
public sentry_deploy table postgres permanent heap 0 bytes
public sentry_discoversavedquery table postgres permanent heap 16 kB
public sentry_discoversavedqueryproject table postgres permanent heap 0 bytes
... ... ... ... ... ... ... ...
public sentry_useremail table postgres permanent heap 8192 bytes
public sentry_userip table postgres permanent heap 72 kB
public sentry_useroption table postgres permanent heap 16 kB
public sentry_userpermission table postgres permanent heap 0 bytes
public sentry_userreport table postgres permanent heap 16 kB
public sentry_userrole table postgres permanent heap 16 kB
public sentry_userrole_users table postgres permanent heap 0 bytes
public social_auth_usersocialauth table postgres permanent heap 8192 bytes
(212 rows)

victorelec14 avatar Aug 02 '23 11:08 victorelec14

Darn, well I'm out of ideas. There must be something else left over that hasn't been cleaned up but I'm not sure where that is. Good luck in figuring this one out

hubertdeng123 avatar Aug 03 '23 22:08 hubertdeng123

@hubertdeng123 I just found the problem, in the configuration yaml file, the url did not have the protocol set. 😬🙈

// onpremise/sentry/config.yml

system.url-prefix: 'sentry.domain.tld'

changed to:

system.url-prefix: 'https://sentry.domain.tld'

Additionally, I have deleted all record from the table "sentry_identityprovider" and also changed the "system.url-prefix" in the "sentry_option", I'm not sure if this also had something to do with the problem.

postgres=# select * from sentry_identityprovider;

id type config date_added external_id
1 gitlab {} 2020-03-17 12:41:23.385283+00 192.168.78.78:3000:11
2 gitlab {} 2021-07-05 09:36:29.91558+00 192.168.78.78:3000:20
3 gitlab {} 2021-07-14 08:20:38.183818+00 old-gitlab.domain.tldt:3000:20

postgres=# select * from sentry_option WHERE key="system.url-prefix";

id key value last_updated last_updated_by
9 system.url-prefix "http://old-sentry.domain.tld:9000" 2021-07-13 14:38:23.140845+00 unknown

Thank you very much for your help, you helped me a lot with the problem ! :D

victorelec14 avatar Jan 22 '24 14:01 victorelec14