Skip to content

Commit

Permalink
fix(session: mysql): server crash when parsing state value to JSON on…
Browse files Browse the repository at this point in the history
… mssql database
  • Loading branch information
ephrimlawrence committed Mar 1, 2024
1 parent c79569a commit 159324b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cli/simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class Simulator {
}

log(data: any) {
this.args.debug = true;
// this.args.debug = true;
if (this.args.debug == true || this.args.debug == "true") {
console.log("");
console.log(data);
Expand Down
2 changes: 1 addition & 1 deletion src/sessions/base.session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface BaseSessionOptions {
}

export interface SQLSessionOptions extends BaseSessionOptions {
type: "postgres" | "mysql";
type: "postgres" | "mysql" | "mssql";

/**
* The name of the table to use for the session, default is `ussd_sessions`
Expand Down
4 changes: 4 additions & 0 deletions src/sessions/mysql.session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export class MySQLSession extends BaseSession {

if (resp.length == 0) return undefined;

if (this.config.type == "mssql") {
return resp == null ? undefined : State.fromJSON(resp[0].state);
}

return resp == null ? undefined : State.fromJSON(JSON.parse(resp[0].state));
}

Expand Down

0 comments on commit 159324b

Please sign in to comment.