Hello, when trying to use the latest cdk version (...
# replication-troubleshooting
k
Hello, when trying to use the latest cdk version (7.0.1) for a python connector, it does not seem to be parsing config variables correctly and returning blank. The error I am getting:
Copy code
{
  "type": "CONNECTION_STATUS",
  "connectionStatus": {
    "status": "FAILED",
    "message": "\"Encountered an error while checking availability of stream merchant_account_stream. Error: Invalid URL 'https:///merchants/merchant_accounts': No host supplied\""
  }
}
And this is the yaml:
Copy code
url_base: >-
          https://{% if config['environment'] == 'Development' %}localhost:3000{% elif config['environment'] == 'Sandbox' %}api.sandbox.braintreegateway.com:443{% elif config['environment'] == 'Qa' %}gateway.qa.braintreepayments.com:443{% elif config['environment'] == 'Production' %}api.braintreegateway.com:443{% endif %}/merchants/{{config['merchant_id']}}
        path: /merchant_accounts
Also I am getting the error:
Copy code
{
  "type": "CONNECTION_STATUS",
  "connectionStatus": {
    "status": "FAILED",
    "message": "\"Encountered an error while discovering streams. Error: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'\""
  }
}
For yaml:
Copy code
incremental_sync:
      type: DatetimeBasedCursor
      cursor_field: created_at
      datetime_format: "%Y-%m-%d %H:%M:%S"
      cursor_datetime_formats:
        - "%Y-%m-%d %H:%M:%S"
        - "%Y-%m-%dT%H:%M:%S"
      start_datetime:
        type: MinMaxDatetime
        datetime: "{{ config['start_date'] }}"
k
Based on the information in your question and the provided knowledge sources, here are the likely causes and solutions for the issues you're encountering with Airbyte CDK 7.0.1 and your YAML configuration: --- ### 1. URL Base Not Parsing Config Variables Error:
Copy code
Invalid URL 'https:///merchants/merchant_accounts': No host supplied
Analysis: This error suggests that the Jinja template in your
url_base
is not correctly interpolating the
config['environment']
variable, resulting in an empty host in the URL. Possible Causes: - The
config['environment']
variable is not being passed or is blank. - The Jinja template syntax may be malformed or not supported as written. Relevant Guidance: - The Airbyte CDK expects config variables to be referenced as
{{ config['variable_name'] }}
within Jinja templates. - If the config variable is missing or blank, the rendered string will be incomplete, leading to invalid URLs. What to Check: - Ensure that your connector's
spec
defines
environment
as a required property and that it is being provided in your connection configuration. - Double-check your Jinja syntax. The template you posted appears to have malformed or incomplete Jinja, with stray
<http://...
and
{%|...
fragments. It should look more like:
Copy code
yaml     url_base: >-       https://{% if config['environment'] == 'Development' %}localhost:3000       {% elif config['environment'] == 'Sandbox' %}api.sandbox.braintreegateway.com:443       {% elif config['environment'] == 'Qa' %}gateway.qa.braintreepayments.com:443       {% elif config['environment'] == 'Production' %}api.braintreegateway.com:443       {% endif %}/merchants/{{ config['merchant_id'] }}
- Make sure there are no stray HTML tags or broken Jinja syntax. --- ### 2. Datetime Parsing Error Error:
Copy code
time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'
Analysis: This error indicates that an empty string is being passed to the datetime parser, which expects a value in the format
%Y-%m-%dT%H:%M:%SZ
. Possible Causes: - The
start_date
config variable is missing or blank. - The
datetime_format
and
cursor_datetime_formats
do not match the actual data or config value. Relevant Guidance: - The
DatetimeBasedCursor
expects the
start_datetime
to be a valid date string matching the specified format. If the config variable is missing, it will pass an empty string, causing this error. - The
datetime_format
should match the format of the date string provided in the config and the data source. If your data uses
"%Y-%m-%dT%H:%M:%SZ"
, your config and formats must match. What to Check: - Ensure your
spec
requires
start_date
and that it is always provided. - Make sure the value of
start_date
in your config matches one of the formats in
cursor_datetime_formats
. - If your data or config uses
"2023-10-04"
, but your format is
"%Y-%m-%d %H:%M:%S"
, you will get a parsing error, as seen in other issues ([source-braintree](https://github.com/airbytehq/airbyte/issues/31061), [source-gorgias](https://github.com/airbytehq/airbyte/issues/48106), [source-adjust](https://github.com/airbytehq/airbyte/issues/41054)). --- ### 3. General Recommendations - Always ensure that all required config variables are present and non-empty. - The format in
datetime_format
and
cursor_datetime_formats
must match the actual data and config values. - If you expect multiple possible formats, list them all in
cursor_datetime_formats
. - If you see errors like
No format in [...] matching ...
, it means the value does not match any of the provided formats. --- ### Example Correction YAML:
Copy code
yaml incremental_sync:   type: DatetimeBasedCursor   cursor_field: created_at   datetime_format: "%Y-%m-%dT%H:%M:%SZ"   cursor_datetime_formats:     - "%Y-%m-%dT%H:%M:%SZ"     - "%Y-%m-%d %H:%M:%S"     - "%Y-%m-%d"   start_datetime:     type: MinMaxDatetime     datetime: "{{ config['start_date'] }}"
- Ensure
start_date
is provided and matches one of the formats above. --- If after these checks the problem persists, please verify the actual values being passed in your config and the rendered YAML, as the Airbyte CDK will not interpolate missing or blank config variables, leading to the errors you are seeing. References: [DatetimeBasedCursor documentation](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/incremental-syncs#datetimebasedcursor) [Source Braintree: date format issue](https://github.com/airbytehq/airbyte/issues/31061) [Source Gorgias: malformed date parsing](https://github.com/airbytehq/airbyte/issues/48106) [Source Adjust: time date format is wrong after migration to lowcode](https://github.com/airbytehq/airbyte/issues/41054)
k
@kapa.ai The config variables exist and works with earlier versions of the cdk but upon upgrade to version 7 I get the errors
k
A message from kapa.ai
Thank you for clarifying that the config variables exist and worked with earlier CDK versions, but are now causing issues after upgrading to version 7. Based on the knowledge sources provided, there is no explicit documentation or changelog entry detailing a breaking change in how config variables are parsed or interpolated in Airbyte CDK version 7. However, your symptoms—config variables not being parsed and returning blank, leading to invalid URLs and datetime parsing errors—are consistent with issues seen when Jinja templates are not evaluated as expected or when the context for interpolation is missing or changed. Key points from the knowledge sources: - Jinja2 string interpolation for config variables should work as
{{ config['variable_name'] }}
and is supported in all recent Airbyte CDK versions, including 1.6 and 1.7, as described in the documentation. Both dot and bracket notation are supported, and variables must be present in the config at runtime for interpolation to succeed [String Interpolation Docs](https://docs.airbyte.com/platform/1.7/connector-development/config-based/advanced-topics/string-interpolation). - There are no explicit notes about changes to config variable handling in the breaking changes documentation for recent Airbyte versions. Breaking changes typically require a major version bump, a
breakingChanges
entry in
metadata.yaml
, and a migration guide, but none of the provided sources mention a change to config variable interpolation [Breaking Changes to Connectors](https://docs.airbyte.com/platform/1.7/contributing-to-airbyte/change-cdk-connector#breaking-changes-to-connectors). - Issues with Jinja template errors (such as undeclared variables or missing context) have been reported in the past, often due to template syntax errors or missing variables in the runtime context, but not specifically tied to a CDK version upgrade [Jinja template error: undeclared variable](https://github.com/airbytehq/airbyte/issues/55209). What this means for your situation: - If your config variables are present and correctly defined, but are not being interpolated after upgrading to CDK 7, this may indicate a regression or a subtle change in how the context is passed to Jinja templates in this version. - The knowledge sources do not provide a definitive answer or workaround for this specific issue in CDK 7.0.1. - It is possible that a change in the CDK or a bug is affecting the context available to Jinja templates, but this is not documented in the provided sources. Recommendation: - Double-check your YAML for any syntax issues, as even small template errors can cause blank values. - If the syntax is correct and the issue persists only in CDK 7, consider raising a GitHub issue with a minimal reproducible example, as this may be an undocumented regression. Summary: I'm sorry, but the knowledge sources do not contain enough information to explain why config variable interpolation would break specifically in Airbyte CDK version 7 when it worked in earlier versions. There is no documented breaking change or migration step related to this in the provided documentation. If you have already verified your config and syntax, this may require further investigation by the Airbyte engineering team.