<@U04S8PLJWMT> Source is Mongo db and destination ...
# ask-ai
g
@kapa.ai Source is Mongo db and destination is Bigquery both are passed as connections but when making the connection between them it gives 504 error
k
A 504 error when connecting MongoDB as a source to BigQuery as a destination in Airbyte is a common issue, especially during the schema discovery phase. Based on the knowledge sources, here are the most likely causes and recommended solutions: ### Causes 1. Timeout During Schema Discovery The schema discovery process can take a long time if your MongoDB database is large or contains many collections. This can cause the web server (often Nginx or a load balancer) to time out, resulting in a 504 Gateway Timeout error. This is frequently reported when connecting MongoDB to BigQuery, especially with large databases or many collections. The error message often appears as "failed to fetch schema" or "504 Gateway Time-out" in the UI or network logs [Failed to load schema in discovery_schema timeout in LoadBalancer](https://discuss.airbyte.io/t/2665), [Failed Connection between mongodb and Bigquery](https://discuss.airbyte.io/t/1793), [MongoDB-Bigquery connection](https://discuss.airbyte.io/t/839). 2. Resource Constraints If the Airbyte worker or server does not have enough memory or CPU, the schema discovery process may be slow or get stuck, leading to timeouts [Failed Connection between mongodb and Bigquery](https://discuss.airbyte.io/t/1793). 3. Network or Proxy Timeout If you are running Airbyte behind a proxy or load balancer, the default timeout settings may be too low for long-running schema discovery operations [Failed to load schema in discovery_schema timeout in LoadBalancer](https://discuss.airbyte.io/t/2665), [Zuora Source "failed to fetch schema"](https://discuss.airbyte.io/t/2976). ### Solutions - Increase Timeout Settings Adjust the timeout settings for your proxy, load balancer, or Nginx server to allow more time for schema discovery. For example, increase the
proxy_read_timeout
and
proxy_connect_timeout
values in your Nginx configuration. This is the most direct fix for 504 errors during schema discovery [Failed to load schema in discovery_schema timeout in LoadBalancer](https://discuss.airbyte.io/t/2665), [Zuora Source "failed to fetch schema"](https://discuss.airbyte.io/t/2976). - Limit MongoDB User Permissions If possible, create a MongoDB user with access only to the collections you need to sync. This reduces the amount of data Airbyte needs to scan during schema discovery, making the process faster and less likely to time out [Failed to load schema in discovery_schema timeout in LoadBalancer](https://discuss.airbyte.io/t/2665). - Split Large Databases If your MongoDB database is very large, consider splitting the sync into multiple connections, each with a user that has access to a subset of collections [Failed Connection between mongodb and Bigquery](https://discuss.airbyte.io/t/1793). - Increase Airbyte Worker Resources Allocate more memory and CPU to your Airbyte worker containers to help them handle large schema discovery operations [Failed Connection between mongodb and Bigquery](https://discuss.airbyte.io/t/1793). - Check Network Connectivity Ensure that your Airbyte instance can reliably connect to your MongoDB server, and that there are no intermittent network issues [Salesforce and Mongo sources failing to sync to destination](https://discuss.airbyte.io/t/737). ### Summary The 504 error is most often due to schema discovery taking longer than your proxy or load balancer allows. Increasing the timeout and limiting the scope of the schema discovery are the most effective solutions. If you continue to have issues, check your Airbyte and server logs for more details and consider sharing them for further troubleshooting. If you need help adjusting your Nginx or load balancer configuration, let me know your setup and I can provide more specific guidance.
g
@kapa.ai So when i checked a small databse it is working but for a big database it is givng this Airbyte is temporarily unavailable. Please try again. (HTTP 502)
k
A message from kapa.ai
When Airbyte works with a small MongoDB database but fails with a large one, showing "Airbyte is temporarily unavailable. Please try again. (HTTP 502)", this is a known issue related to schema discovery timeouts. The schema discovery process can take a long time for databases with many collections or large amounts of data, causing Airbyte or your proxy/load balancer to time out and return a 502 error. Recommended solutions from the knowledge sources: - Increase Timeout Limits: You can increase Airbyte's timeout settings to allow more time for schema discovery. For example, in your
values.yaml
(if using Helm), add or adjust:
Copy code
yaml   server:       extraEnv:         - name: HTTP_IDLE_TIMEOUT           value: 20m         - name: READ_TIMEOUT           value: 30m
This will give the discovery process more time to complete for large databases. The exact configuration may vary depending on your Airbyte version and deployment method, but the principle is the same across versions [Scaling Airbyte: Schema Discovery Timeouts](https://docs.airbyte.com/platform/enterprise-setup/scaling-airbyte#schema-discovery-timeouts). - Limit MongoDB User Permissions: If possible, create a MongoDB user with access only to the collections you need. This reduces the amount of data Airbyte needs to scan, making discovery faster and less likely to time out [Failed to load schema in discovery_schema timeout in LoadBalancer](https://discuss.airbyte.io/t/2665). - Split Large Databases: For very large databases, consider splitting the sync into multiple connections, each with a user that has access to a subset of collections [Failed Connection between mongodb and Bigquery](https://discuss.airbyte.io/t/1793). Summary: The 502 error for large databases is due to schema discovery taking too long. Increasing timeout settings and limiting the scope of discovery are the recommended solutions according to Airbyte documentation and community discussions.