MeltanoLabs / tap-gitlab

Singer.io Tap for extracting data from Gitlab's API
GNU Affero General Public License v3.0
8 stars 25 forks source link

Handle 403 (Forbidden) errors gracefully #16

Closed pnadolny13 closed 2 years ago

pnadolny13 commented 2 years ago

In GitLab by @iroussos on Oct 16, 2019, 13:03

If a user is not allowed to access a resource, an HTTP 403 (Forbidden) error is returned by Gitlab's API.

At the moment, we don't handle those errors, resulting in tap-gitlab stopping its execution when trying to access a forbidden resource. Example provided in meltano/dbt-tap-gitlab#4:

... ... ...
INFO GET https://gitlab.com/api/v4/projects/XXXXX/merge_requests?scope=all

CRITICAL Error making request to GitLab API: GET https://gitlab.com/api/v4/projects/14707715/merge_requests?scope=all
[403 - b'{"message":"403 Forbidden"}']
... ... ...

This is important when accessing all the projects under a group as some of those projects may be private and not available to the user. This is also important for allowing a user without elevated privileges to at least partially fetch some of the entities available to them (e.g. fetch issues and MRs while failing to fetch members)

We should handle those errors gracefully:

  1. Skip the extraction of entities that you get a 403 (Forbidden) error for
  2. Continue with the rest of the extraction process
  3. Inform the user about the Entities we did not fetch cause they had no access to them
pnadolny13 commented 2 years ago

In GitLab by @iroussos on Oct 16, 2019, 13:09

changed the description

pnadolny13 commented 2 years ago

In GitLab by @iroussos on Nov 1, 2019, 09:31

mentioned in merge request !19

pnadolny13 commented 2 years ago

In GitLab by @iroussos on Nov 1, 2019, 09:38

closed via merge request !19

pnadolny13 commented 2 years ago

In GitLab by @iroussos on Nov 1, 2019, 09:38

mentioned in commit 98362900d1ae6cbbf03b9dc3e2fe894f4cad1fc4