Problem
While clicking Test Connection for Databricks in Sparkflows, I’m getting one of the following errors:
- Not able to access the resource. Please check host url
- Invalid access token. Please check token
- HTTP failure response for
http://<host_ip>:8080/testConnection: 403 Forbidden
How can I troubleshoot and fix this issue?
Solution
This issue usually occurs when Sparkflows is unable to communicate with Databricks or when the authentication details are incorrect. Below are the common causes and step-by-step troubleshooting actions.
Possible Causes
- The JDBC Databricks URL configured in Sparkflows is incorrect.
- The Databricks access token is invalid or misconfigured.
- The Databricks REST API is not accessible from the Sparkflows machine.
- The Databricks token does not have sufficient permissions.
- A Load Balancer / WAF (X-XSRF restriction) is blocking the request.
Troubleshooting Steps
Sparkflows connects to Databricks using the Databricks REST API to submit jobs. Ensure that this API is accessible from the Sparkflows host.
Step 1: Check Network Connectivity
Verify that the Sparkflows machine can reach the Databricks workspace:
telnet xxxx.cloud.databricks.com 443
Note: Replace xxxx.cloud.databricks.com with your actual Databricks Workspace URL.
Step 2: Validate Databricks Token & REST API Access
Test whether the Databricks endpoint is reachable and the token is valid by fetching cluster details:
curl -i https://xxxxx.azuredatabricks.net/api/2.0/clusters/get?cluster_id=xxxxx \
-H "Authorization: Bearer <Databricks_Token>"
Note:
- Replace the Databricks host URL with your workspace URL
- Update
cluster_idwith a valid cluster ID - Ensure the token has required permissions
Step 3: Test Databricks Connection from Sparkflows API
Use the Sparkflows API to test the Databricks connection:
curl --location 'http://sparkflows_host/api/v1/connections/test' \
--header 'token: sparkflows_token' \
--header 'Content-Type: application/json' \
--data '{
"credentialStoreId": -1,
"id": 1,
"url": "JDBC Databricks URL",
"password": "Databricks_Token",
"connectionType": "databricks",
"authenticationType": "USER_CREDENTIAL"
}'
Note: Replace the following with actual values:
sparkflows_hostsparkflows_tokenJDBC Databricks URLDatabricks_Token
Step 4: Check WAF / Load Balancer Settings (Azure)
If you are using Azure Application Gateway with WAF v2:
- Disable Inspect Request Body in Global Parameters
- This avoids request blocking due to X-XSRF restrictions