Skip to content

Commit

Permalink
fix: define context outside try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
willhausman committed Jan 3, 2020
1 parent bd7cca6 commit 3075624
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/cubejs-api-gateway/SubscriptionServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class SubscriptionServer {

async processMessage(connectionId, message, isSubscription) {
let authContext = {};
let context = {};
try {
if (typeof message === 'string') {
message = JSON.parse(message);
Expand Down Expand Up @@ -61,7 +62,7 @@ class SubscriptionServer {
}

const requestId = message.requestId || `${connectionId}-${message.messageId}`;
const context = await this.apiGateway.contextByReq(message, authContext.authInfo, requestId);
context = await this.apiGateway.contextByReq(message, authContext.authInfo, requestId);

const allowedParams = methodParams[message.method];
const params = allowedParams.map(k => ({ [k]: (message.params || {})[k] }))
Expand Down

0 comments on commit 3075624

Please sign in to comment.