Davy van der Horst
09/09/2025, 4:08 PM# Airbyte Connection
resource "airbyte_connection" "connection" {
name = var.connection_name
source_id = var.source_id
destination_id = var.destination_id
status = var.status
namespace_definition = "destination"
non_breaking_schema_updates_behavior = "ignore"
schedule = {
schedule_type = "cron"
cron_expression = var.schedule_cron
}
# Stream configurations will be set up initially as inactive and then configured via Airbyte UI
# This follows the pattern that was working previously
}kapa.ai
09/09/2025, 4:09 PMsync_catalog or stream configuration, the provider may not be able to create the connection properly, causing it to hang or fail. The documentation and examples show that you should define the streams you want to sync as part of the connection resource. If you intend to configure streams later via the UI, this may not be supported by the provider and could be the cause of the issue. Try specifying at least one stream in the resource definition, even if it's a placeholder, to see if the resource can be created successfully [Terraform provider: Create a connection](https://docs.airbyte.com/platform/terraform-documentation#step-4-create-a-connection). 2. Check for API or Provider Errors If the provider or Airbyte API encounters an error (such as a misconfiguration or missing required fields), it may return a 500 error or hang. Review the Airbyte server logs for any errors during the Terraform apply process. Also, ensure you are using a compatible and up-to-date version of the Airbyte Terraform provider, as some bugs (such as enum case mismatches) have been fixed in newer versions [Github Issue: data_residency property of connection blocks the Terraform provider](https://github.com/airbytehq/airbyte/issues/56454). 3. Cron Schedule Support Cron scheduling is supported in recent Airbyte versions, but if you are using an older version of Airbyte or the provider, the cron schedule fields may not be recognized, causing the resource creation to fail or hang. Make sure both your Airbyte instance and the Terraform provider are up to date [Forum Post: Cron schedule via apis not working](https://discuss.airbyte.io/t/2327). 4. General Troubleshooting Steps - Double-check that your source_id and destination_id are valid and that the corresponding resources exist and are healthy. - Run terraform plan to see if there are any obvious configuration issues before applying. - If you see errors in the Terraform output or Airbyte logs, review them for clues about missing or invalid fields. Summary: The most likely cause is the lack of stream configuration in your airbyte_connection resource. The Airbyte Terraform provider generally requires you to specify the streams to sync at creation time. Try adding the stream configuration, and ensure you are using the latest provider and Airbyte versions. If the problem persists, check the Airbyte logs and Terraform output for more specific error messages. If you need an example of how to specify streams in the connection resource, let me know!Davy van der Horst
09/09/2025, 4:13 PM# Airbyte Connection
resource "airbyte_connection" "connection" {
name = var.connection_name
source_id = var.source_id
destination_id = var.destination_id
status = var.status
namespace_definition = "destination"
non_breaking_schema_updates_behavior = "ignore"
schedule = {
schedule_type = "cron"
cron_expression = var.schedule_cron
}
# Stream configurations - Required by Airbyte Terraform provider
configurations = {
streams = [
for stream in var.enabled_streams : {
name = stream
sync_mode = "full_refresh_overwrite"
cursor_field = []
primary_key = []
selected = true
}
]
}
}
Still ends up in:
│ Error: failure to invoke API
│
│ with module.facebook_ads_connection.airbyte_connection.connection,
│ on ../modules/airbyte-connection/main.tf line 2, in resource "airbyte_connection" "connection":
│ 2: resource "airbyte_connection" "connection" {
│
│ unknown status code returned: Status 500
│ {"message":"Internal Server Error:
│ null","exceptionClassName":"java.lang.NullPointerException","exceptionStack":[],"rootCauseExceptionStack":[]}
╵
task: Failed to run task "devapply3-applications:auto": exit status 1Davy van der Horst
09/09/2025, 4:14 PM# Airbyte Connection
resource "airbyte_connection" "connection" {
name = var.connection_name
source_id = var.source_id
destination_id = var.destination_id
status = var.status
namespace_definition = "destination"
non_breaking_schema_updates_behavior = "ignore"
schedule = {
schedule_type = "cron"
cron_expression = var.schedule_cron
}
# Stream configurations - Required by Airbyte Terraform provider
configurations = {
streams = [
for stream in var.enabled_streams : {
name = stream
sync_mode = "full_refresh_overwrite"
cursor_field = []
primary_key = []
selected = true
}
]
}
}
Still ends up in:
│ Error: failure to invoke API
│
│ with module.facebook_ads_connection.airbyte_connection.connection,
│ on ../modules/airbyte-connection/main.tf line 2, in resource "airbyte_connection" "connection":
│ 2: resource "airbyte_connection" "connection" {
│
│ unknown status code returned: Status 500
│ {"message":"Internal Server Error:
│ null","exceptionClassName":"java.lang.NullPointerException","exceptionStack":[],"rootCauseExceptionStack":[]}
╵
task: Failed to run task "devapply3-applications:auto": exit status 1kapa.ai
09/09/2025, 4:14 PMkapa.ai
09/09/2025, 4:15 PMNullPointerException. This is a generic error, but there are several known causes and troubleshooting steps documented in the knowledge sources: 1. NullPointerException in Airbyte API This error often occurs when the Airbyte API expects certain fields or configurations that are missing or not properly set. Several issues in the knowledge base reference similar errors when required fields (like stream configuration or catalog discovery) are missing or not correctly populated. For example, if the source schema or catalog cannot be discovered, or if the stream configuration is incomplete, the API may throw a NullPointerException ([Mixpanel connector issue](https://discuss.airbyte.io/t/2814), [Severe Performance Degradation Mongo Connector](https://discuss.airbyte.io/t/1011), [Github Issue: error 500 cannot invoke API](https://github.com/airbytehq/airbyte/issues/44094)). 2. Stream Configuration and Catalog Discovery The Airbyte Terraform provider requires that the streams you specify in the configurations block match the streams available in the source's catalog. If the stream names in var.enabled_streams do not exactly match the discovered streams from the source, or if the source is not healthy or properly configured, the connection creation can fail with a 500 error. This is a common cause of this error in Terraform workflows ([Github Issue: error 500 cannot invoke API](https://github.com/airbytehq/airbyte/issues/44094)). 3. Check Source and Destination Health Ensure that both your source and destination are healthy and that their IDs are correct. If the source cannot be reached or its schema cannot be discovered, the connection cannot be created and may result in a NullPointerException ([Github Issue: error 500 cannot invoke API](https://github.com/airbytehq/airbyte/issues/44094)). 4. Provider and Airbyte Version Compatibility Some errors are caused by mismatches or bugs in specific versions of the Airbyte Terraform provider or Airbyte itself. Make sure you are using the latest versions, as some issues (such as enum case mismatches or missing fields) have been fixed in newer releases ([Github Issue: data_residency property of connection blocks the Terraform provider](https://github.com/airbytehq/airbyte/issues/56454)). What you should do: - Double-check that all streams in var.enabled_streams exist in the source and are discoverable. - Ensure your source and destination are healthy and properly configured. - Try running the connection creation with a single, known-good stream to isolate the issue. - Review Airbyte server logs for more detailed error messages. - Make sure you are using the latest Airbyte and Terraform provider versions. If after these checks the issue persists, it may be a bug or a deeper configuration issue. In that case, providing Airbyte server logs or more details about your source/destination setup would be necessary for further troubleshooting. Summary: The knowledge sources indicate that a 500 error with a NullPointerException during connection creation is most often due to missing or mismatched stream configuration, or issues with source schema discovery. Double-check your stream names, source health, and provider versions as a first step ([Github Issue: error 500 cannot invoke API](https://github.com/airbytehq/airbyte/issues/44094), [Mixpanel connector issue](https://discuss.airbyte.io/t/2814)).