How are you running Sentry?
I successfully make GitLab Integration through the Settings -> ProjectName -> Intergations-> GitLab. But I can't add Repository through the "Add repository" button (Settings -> ProjectName -> Intergations-> GitLab -> Configure).
My user in Sentry is main admin, my user in GitLab is Owner and has permission to target repo.
When I click to "Add repository button" displayed "Saving changes" message and repository does not added. I open console and find this request.
{"error_type": "validation", "errors": {"__all__": "Error Communicating with GitLab (HTTP 422): unknown error"}}
Configured by this manual page: https://docs.sentry.io/workflow/integrations/global-integrations/gitlab/
Excepted selected repository appears in repository list on this page, but nothing happens.
In "internal" project I received this errors:
TypeError - Cannot read property 'errors' of undefined
./app/actionCreators/integrations.jsx at line 108:43
repo: repo.name,
});
addSuccessMessage(message);
},
errorData => {
const text = errorData.responseJSON.errors
? errorData.responseJSON.errors.__all__
: t('Unable to add repository.');
addErrorMessage(text);
}
);
OS: Ubuntu 18.04.2 LTS
Docker Server Engine: 18.09.2
Docker Server API: 1.39
Docker Client: 18.09.2
Docker Client API: 1.39
Sentry: 9.1.1
May be it needed to fix frontend TypeError error and make some backend requests after it.
GitLab will return a 422 when it cannot validate the certificate of your sentry instance or if your sentry instance does not have a publicly reachable domain name/IP address.
@markstory My GitLab instance and Sentry instance both located in one local network and sentry instance does not have a publicly reachable domain name/IP address. Sentry instance available at http (not htttps). How can I connect them?
Hello,
I have exactly the same problem. Small differences :
@netandreus @husim0 You'll have to add some additional logging here to get the full response payload from GitLab. I'm not going to be of much more help in solving this issue as I can't see your networks or anything running on them.
@husim0 @markstory I try to investigate this issue. First of all I run
tail -f /var/log/gitlab/gitlab-rails/api_json.log
on my GitLab VM to see what happens.
I found this this log entry after try to add repo in sentry ui:
{
"time": "2019-05-08T07:05:56.332Z",
"severity": "INFO",
"duration": 7.38,
"db": 1.05,
"view": 6.33,
"status": 422,
"method": "POST",
"path": "/api/v4/projects/34/hooks",
"params": [
{
"key": "url",
"value": "http://x.x.x.x:9000/extensions/gitlab/webhook/"
},
{
"key": "token",
"value": "xxxxxxxxxxxx"
},
{
"key": "push_events",
"value": null
},
{
"key": "enable_ssl_verification",
"value": null
},
{
"key": "merge_requests_events",
"value": null
}
],
"host": "git.my.domain",
"ip": "192.168.11.30, 127.0.0.1",
"ua": "sentry/9.1.1 (https://sentry.io)",
"route": "/api/:version/projects/:id/hooks",
"user_id": 1,
"username": "sentry",
"queue_duration": 2.6,
"gitaly_calls": 0,
"gitaly_duration": 0,
"correlation_id": "xxxxxxxxxx"
}
I try to reproduce this API request through GitLab web UI and and saw there "Url is blocked: Requests to the local network are not allowed." error message.
I'm trying to google this error and found this issue https://gitlab.com/gitlab-org/gitlab-ce/issues/45134
Yeah, there is GitLab option that allows all local webhooks requests and it's disable by default.
Finally solution is to enable this option in GitLab:
GitLab -> Admim area -> Settings -> Network -> Outbound requests -> Allow requests to the local network from hooks and services
@markstory Should this ticket be closed? I see a note was added to the docs regarding a specific Gitlab setting, but isn't this original error report highlighting lack of proper error handling on the add repository screen? I don't see where this error is being handled:
TypeError - Cannot read property 'errors' of undefined
@bdw429s Here is link to the docs. https://github.com/getsentry/sentry-docs/pull/972 Status: Review required
About Type error - may be this is just another error.
@netandreus Either you didn't understand my post, or I don't understand yours.
I'm pointing out that the "typeerror" itself appears to be a bug in Sentry's handling of failures while adding a repository and Sentry needs to fix this bug. It's great that we updated the docs, but that is pointless if all we did was add a note somewhere to help someone figure out when Sentry's error handling fails to perform, when we should have fixed the error handling in the first place so the user actually got a useful message in their browser as opposed to the current behavior of a spinner popping up for a few seconds and then... nothing. I stared at my screen for quite some time with zero feedback from Sentry before finding this thread. So yes, it's "just another error" and "let's actually fix it" and not just throw a note in the docs and call it a day :)
IMO, this ticket isn't closed until Sentry properly handles situations in which the Gitlab calls fail (or more broadly, whatever the backend Repo endpoint is). In fact, I would suggest a two pronged approach to fixing this:
@bdw429s I totally agree with you. This is another error, and it is not normal that the processing of responses from GitLab does not work properly. Because of this, other errors related to GtiLab can also be hidden.
Glad we're on the same page. @markstory can this ticket be reopened until such a time as the original error reported is resolved?
We can make the 422 scenario better. I agree it would be good to bubble that error up the the frontend.
Thanks @markstory :+1:
Most helpful comment
@husim0 @markstory I try to investigate this issue. First of all I run
tail -f /var/log/gitlab/gitlab-rails/api_json.logon my GitLab VM to see what happens.
I found this this log entry after try to add repo in sentry ui:
I try to reproduce this API request through GitLab web UI and and saw there "Url is blocked: Requests to the local network are not allowed." error message.
I'm trying to google this error and found this issue https://gitlab.com/gitlab-org/gitlab-ce/issues/45134
Yeah, there is GitLab option that allows all local webhooks requests and it's disable by default.
Finally solution is to enable this option in GitLab:
GitLab -> Admim area -> Settings -> Network -> Outbound requests -> Allow requests to the local network from hooks and services