Skip to content

Commit

Permalink
✨ Source Github: updated user error messages (#30927)
Browse files Browse the repository at this point in the history
  • Loading branch information
darynaishchenko authored and girarda committed Oct 4, 2023
1 parent 71b0ef2 commit 6f951b4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=1.4.1
LABEL io.airbyte.version=1.4.2
LABEL io.airbyte.name=airbyte/source-github
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: ef69ef6e-aa7f-4af1-a01d-ef775033524e
dockerImageTag: 1.4.1
dockerImageTag: 1.4.2
maxSecondsBetweenMessages: 5400
dockerRepository: airbyte/source-github
githubIssueLabel: source-github
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ def _ensure_default_values(self, config: MutableMapping[str, Any]) -> MutableMap
api_url_parsed = urlparse(config["api_url"])

if not api_url_parsed.scheme.startswith("http"):
message = "Please enter a full URL starting with http..."
message = "Please enter a full url for `API URL` field starting with `http`"
elif api_url_parsed.scheme == "http" and not self._is_http_allowed():
message = "HTTP connection is insecure and is not allowed in this environment. Please use `https` instead."
elif not api_url_parsed.netloc:
message = "Please provide a correct URL"
message = "Please provide a correct API URL."
else:
return config

Expand Down Expand Up @@ -209,7 +209,7 @@ def user_friendly_error_message(self, message: str) -> str:
elif "404 Client Error: Not Found for url: https://api.github.com/orgs/" in message:
# 404 Client Error: Not Found for url: https://api.github.com/orgs/airbytehqBLA/repos?per_page=100
org_name = message.split("https://api.github.com/orgs/")[1].split("/")[0]
user_message = f'Organization name: "{org_name}" is unknown, "repository" config option should be updated'
user_message = f'Organization name: "{org_name}" is unknown, "repository" config option should be updated. Please validate your repository config.'
elif "401 Client Error: Unauthorized for url" in message:
# 401 Client Error: Unauthorized for url: https://api.github.com/orgs/datarootsio/repos?per_page=100&sort=updated&direction=desc
user_message = (
Expand Down Expand Up @@ -253,6 +253,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
user_message = (
"No streams available. Looks like your config for repositories or organizations is not valid."
" Please, check your permissions, names of repositories and organizations."
" Needed scopes: repo, read:org, read:repo_hook, read:user, read:discussion, workflow."
)
raise AirbyteTracedException(
internal_message="No streams available. Please check permissions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ def check_source(repo_line: str) -> AirbyteConnectionStatus:
@pytest.mark.parametrize(
"api_url, deployment_env, expected_message",
(
("github.my.company.org", "CLOUD", "Please enter a full URL starting with http..."),
("github.my.company.org", "CLOUD", "Please enter a full url for `API URL` field starting with `http`"),
(
"http://github.my.company.org",
"CLOUD",
"HTTP connection is insecure and is not allowed in this environment. Please use `https` instead.",
),
("http:/github.my.company.org", "NOT_CLOUD", "Please provide a correct URL"),
("https:/github.my.company.org", "CLOUD", "Please provide a correct URL"),
("http:/github.my.company.org", "NOT_CLOUD", "Please provide a correct API URL."),
("https:/github.my.company.org", "CLOUD", "Please provide a correct API URL."),
),
)
def test_connection_fail_due_to_config_error(api_url, deployment_env, expected_message):
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ The GitHub connector should not run into GitHub API limitations under normal usa

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1.4.2 | 2023-09-30 | [30927](https://github.com/airbytehq/airbyte/pull/30927) | Provide actionable user error messages |
| 1.4.1 | 2023-09-30 | [30839](https://github.com/airbytehq/airbyte/pull/30839) | Update CDK to Latest version |
| 1.4.0 | 2023-09-29 | [30823](https://github.com/airbytehq/airbyte/pull/30823) | Add new stream `issue Timeline Events` |
| 1.3.1 | 2023-09-28 | [30824](https://github.com/airbytehq/airbyte/pull/30824) | Handle empty response in stream `ContributorActivity` |
Expand Down

0 comments on commit 6f951b4

Please sign in to comment.