File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -74,4 +74,4 @@ GATHERSG_PUBLIC_KEY=gathersg-public-key
7474# DATABRICKS
7575DATABRICKS_SERVER_HOSTNAME=...
7676DATABRICKS_HTTP_PATH=...
77- DATABRICKS_CATALOG=...
77+ DATABRICKS_CATALOG=...
Original file line number Diff line number Diff line change @@ -3,19 +3,33 @@ import { IGlobalVariable } from '@plumber/types'
33import { ZodError } from 'zod'
44import { fromZodError } from 'zod-validation-error'
55
6+ import { databricksConfig } from '@/config/app-env-vars/databricks'
7+ import logger from '@/helpers/logger'
8+
69import { validateAuthData } from './auth-data'
710import { createClient } from './create-client'
811
912const verifyCredentials = async ( $ : IGlobalVariable ) => {
1013 try {
1114 validateAuthData ( $ )
1215 const client = await createClient ( $ )
16+ const session = await client . openSession ( {
17+ initialCatalog : databricksConfig . catalog ,
18+ } )
19+ await session . close ( )
1320 await client . close ( )
1421 } catch ( error ) {
1522 if ( error instanceof ZodError ) {
1623 // Auth data validation failed: throws message from first error
1724 throw new Error ( fromZodError ( error ) . details [ 0 ] . message )
1825 }
26+ if ( error . response ?. status === 401 ) {
27+ logger . info ( {
28+ event : 'databricks-verify-credentials' ,
29+ error : error ,
30+ } )
31+ throw new Error ( 'Invalid credentials' )
32+ }
1933 throw error
2034 }
2135}
You can’t perform that action at this time.
0 commit comments