QuickBooks Connector Token Expiry Issue

Summary

The user is facing an issue with the QuickBooks connector in Airbyte where the token expires and the connection is not refreshing. The error message indicates a 400 Client Error: Bad Request for url related to token refresh.


Question

Airbyte, Self-Hosted, Ubuntu Server
I’m up and running with Airbyte and using the QuickBooks connector to pull data. The initial connection works fine and I’m loving the output. I am running into an issue where the token expires and the connection is not refreshing. I am running the latest version from the Airbyte repo and am using V3.0.2 of the QuickBooks connector. Any help would be GREATLY appreciated! I’m receiving this error in the logs:

2024-04-02 02:02:45 [46mplatform[0m > Using default value for environment variable SOCAT_KUBE_CPU_LIMIT: '2.0'
2024-04-02 02:02:45 [46mplatform[0m > 
2024-04-02 02:02:45 [46mplatform[0m > Using default value for environment variable SIDECAR_KUBE_CPU_REQUEST: '0.1'
2024-04-02 02:02:45 [46mplatform[0m > Using default value for environment variable SOCAT_KUBE_CPU_REQUEST: '0.1'
2024-04-02 02:02:45 [46mplatform[0m > Checking if airbyte/source-quickbooks:3.0.2 exists...
2024-04-02 02:02:45 [46mplatform[0m > airbyte/source-quickbooks:3.0.2 was found locally.
2024-04-02 02:02:45 [46mplatform[0m > Creating docker container = source-quickbooks-check-28-0-mcpiq with resources io.airbyte.config.ResourceRequirements@670b0316[cpuRequest=,cpuLimit=,memoryRequest=,memoryLimit=,additionalProperties={}] and allowedHosts io.airbyte.config.AllowedHosts@2ff347a9[hosts=[sandbox-quickbooks.api.intuit.com, quickbooks.api.intuit.com, oauth.platform.intuit.com, *.datadoghq.com, *.datadoghq.eu, *.sentry.io],additionalProperties={}]
2024-04-02 02:02:45 [46mplatform[0m > Preparing command: docker run --rm --init -i -w /data/28/0 --log-driver none --name source-quickbooks-check-28-0-mcpiq --network host -v airbyte_workspace:/data -v oss_local_root:/local -e DEPLOYMENT_MODE=OSS -e WORKER_CONNECTOR_IMAGE=airbyte/source-quickbooks:3.0.2 -e AUTO_DETECT_SCHEMA=true -e LAUNCHDARKLY_KEY= -e SOCAT_KUBE_CPU_REQUEST=0.1 -e SOCAT_KUBE_CPU_LIMIT=2.0 -e FIELD_SELECTION_WORKSPACES= -e USE_STREAM_CAPABLE_STATE=true -e WORKER_ENVIRONMENT=DOCKER -e AIRBYTE_ROLE=dev -e APPLY_FIELD_SELECTION=false -e WORKER_JOB_ATTEMPT=0 -e OTEL_COLLECTOR_ENDPOINT=<http://host.docker.internal:4317> -e FEATURE_FLAG_CLIENT=config -e AIRBYTE_VERSION=0.55.1 -e WORKER_JOB_ID=28 airbyte/source-quickbooks:3.0.2 check --config source_config.json
2024-04-02 02:02:45 [46mplatform[0m > Reading messages from protocol version 0.2.0
2024-04-02 02:02:49 [46mplatform[0m > Encountered an error trying to connect to stream accounts. Error: 
 Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/checks/check_stream.py", line 42, in check_connection
    stream_is_available, reason = availability_strategy.check_availability(stream, logger, source)
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/availability_strategy.py", line 56, in check_availability
    is_available, reason = self.handle_http_error(stream, logger, source, error)
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/availability_strategy.py", line 85, in handle_http_error
    raise error
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/availability_strategy.py", line 50, in check_availability
    get_first_record_for_slice(stream, stream_slice)
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/utils/stream_helper.py", line 40, in get_first_record_for_slice
    return next(records_for_slice)
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/declarative_stream.py", line 104, in read_records
    yield from self.retriever.read_records(self.get_json_schema(), stream_slice)
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 323, in read_records
    for stream_data in self._read_pages(record_generator, self.state, stream_slice):
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 287, in _read_pages
    response = self._fetch_next_page(stream_state, stream_slice, next_page_token)
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 262, in _fetch_next_page
    return self.requester.send_request(
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 454, in send_request
    headers=self._request_headers(stream_state, stream_slice, next_page_token, request_headers),
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 308, in _request_headers
    headers = self._get_request_options(
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 292, in _get_request_options
    auth_options_method(),
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 56, in get_auth_header
    return {"Authorization": f"Bearer {self.get_access_token()}"}
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 61, in get_access_token
    token, expires_in = self.refresh_access_token()
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 150, in refresh_access_token
    response_json = self._get_refresh_access_token_response()
  File "/usr/local/lib/python3.9/site-packages/backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 132, in _get_refresh_access_token_response
    response.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: <https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer>

2024-04-02 02:02:49 [46mplatform[0m > Check failed
2024-04-02 02:02:49 [46mplatform[0m > Check connection job received output: io.airbyte.config.StandardCheckConnectionOutput@2ac47e22[status=failed,message='Unable to connect to stream accounts - 400 Client Error: Bad Request for url: <https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer',additionalProperties={}>]
2024-04-02 02:02:49 [46mplatform[0m > 
2024-04-02 02:02:49 [46mplatform[0m > ----- END CHECK -----```

<br>

---

This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here](https://airbytehq.slack.com/archives/C021JANJ6TY/p1712110134230699) if you want to access the original thread.

[Join the conversation on Slack](https://slack.airbyte.com)

<sub>
["airbyte", "self-hosted", "ubuntu-server", "quickbooks-connector", "token-expiry", "refresh-issue", "400-client-error"]
</sub>