Skip to content

Commit 894901e

Browse files
committed
fix(cubesql): Propagate errors from SqlAuthService to the user
1 parent 91d57de commit 894901e

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

packages/cubejs-api-gateway/src/sql-server.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,25 @@ export class SQLServer {
128128
};
129129
},
130130
checkSqlAuth: async ({ request, user, password }) => {
131-
const { password: returnedPassword, superuser, securityContext, skipPasswordCheck } = await checkSqlAuth(request, user, password);
132-
133-
return {
134-
password: returnedPassword,
135-
superuser: superuser || false,
136-
securityContext,
137-
skipPasswordCheck,
138-
};
131+
try {
132+
const { password: returnedPassword, superuser, securityContext, skipPasswordCheck } = await checkSqlAuth(request, user, password);
133+
134+
return {
135+
password: returnedPassword,
136+
superuser: superuser || false,
137+
securityContext,
138+
skipPasswordCheck,
139+
};
140+
} catch (e) {
141+
this.apiGateway.log({
142+
type: 'Auth Error',
143+
protocol: (request as any).protocol,
144+
method: (request as any).method,
145+
apiType: 'sql',
146+
error: (e as Error).stack || (e as Error).toString(),
147+
});
148+
throw e;
149+
}
139150
},
140151
meta: async ({ request, session, onlyCompilerId }) => {
141152
const context = await this.apiGateway.contextByReq(<any> request, session.securityContext, request.id);

0 commit comments

Comments
 (0)