Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix Intercom stream base url in check connection #11176

Merged

Conversation

mrhallak
Copy link
Contributor

@mrhallak mrhallak commented Mar 15, 2022

What

Hello Airbyte team! I was giving the tool a shot and wanted to use Intercom as a source. I noticed the extra slash at the end of the URL through the logs I got because I was not able to connect.

How

The solution is pretty simple - just removing the slash at the end of the base url.

Recommended reading order

  1. python

🚨 User Impact 🚨

There shouldn't be any breaking changes here

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here
Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the new connector version is published, connector version bumped in the seed directory as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here
Connector Generator
  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed

Tests

Note some tests failed - it seems the Intercom token I have does not grant me access to everything which is expected because I'm using a token provided by my organization

Acceptance

Results (17.32s):
17 passed
5 failed
- ../airbyte/source_acceptance_test/source_acceptance_test/tests/test_core.py:144 TestConnection.test_check[inputs0]
- ../airbyte/source_acceptance_test/source_acceptance_test/tests/test_core.py:355 TestBasicRead.test_read[inputs0]
- ../airbyte/source_acceptance_test/source_acceptance_test/tests/test_full_refresh.py:39 TestFullRefresh.test_sequential_reads[inputs0]
- ../airbyte/source_acceptance_test/source_acceptance_test/tests/test_incremental.py:81 TestIncremental.test_two_sequential_reads[inputs0]
- ../airbyte/source_acceptance_test/source_acceptance_test/tests/test_incremental.py:105 TestIncremental.test_state_with_abnormally_large_values[inputs0]

@CLAassistant
Copy link

CLAassistant commented Mar 15, 2022

CLA assistant check
All committers have signed the CLA.

@@ -18,7 +18,7 @@


class IntercomStream(HttpStream, ABC):
url_base = "https://api.intercom.io/"
url_base = "https://api.intercom.io"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is concatenated with stream paths below to form https://api.intercom.io/<path> -- is it safe to do this?

Copy link
Member

@marcosmarxm marcosmarxm Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reading stream data doesn't matter urljoin will parse correctly with / or without.

The problem happens in the check connection function where is concatenating using f-string and not urljoin.

url = f"{IntercomStream.url_base}/tags"
auth_headers = {"Accept": "application/json", **authenticator.get_auth_header()}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sherifnada @marcosmarxm Would you guys prefer it if I change it to a urljoin?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be better imo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@marcosmarxm
Copy link
Member

@mrhallak can you sign the CLA?

@marcosmarxm marcosmarxm self-assigned this Mar 16, 2022
@mrhallak
Copy link
Contributor Author

@mrhallak can you sign the CLA?

Done!

@marcosmarxm
Copy link
Member

/test connector=connectors/source-intercom repo=mrhallak/airbyte

@marcosmarxm marcosmarxm changed the title [Bug fix] Intercom stream base url 🐛 Fix Intercom stream base url in check connection Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source Intercom: extra slash in Intercom base url
5 participants