Skip to content

Commit

Permalink
fix Connected to undefined message
Browse files Browse the repository at this point in the history
ENG-5604
  • Loading branch information
fauna-chase committed Oct 10, 2023
1 parent ceb326c commit b5f7a37
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
6 changes: 2 additions & 4 deletions src/commands/shell.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const FaunaCommand = require("../lib/fauna-command.js").default;
const { runQueries, stringifyEndpoint } = require("../lib/misc.js");
const { runQueries } = require("../lib/misc.js");
const faunadb = require("faunadb");
const { Flags, Args } = require("@oclif/core");
const q = faunadb.query;
Expand Down Expand Up @@ -41,9 +41,7 @@ class ShellCommand extends EvalCommand {
this.log(`Starting shell for database ${db_path}`);
}

this.log(
`Connected to ${stringifyEndpoint(this.connection.connectionOptions)}`
);
this.log(`Connected to ${this.connection.connectionOptions.url}`);
this.log("Type Ctrl+D or .exit to exit the shell");

this.repl = repl.start({
Expand Down
5 changes: 1 addition & 4 deletions src/lib/fauna-command.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Command, Flags } from "@oclif/core";
import { ShellConfig } from "./config";
import { stringifyEndpoint } from "./misc";
import { query as q, errors, Client } from "faunadb";
import { green } from "chalk";
import FaunaClient from "./fauna-client";
Expand Down Expand Up @@ -85,9 +84,7 @@ class FaunaCommand extends Command {
mapConnectionError({ err, connectionOptions }) {
if (err instanceof errors.Unauthorized) {
return this.error(
`Could not Connect to ${stringifyEndpoint(
connectionOptions
)} Unauthorized Secret`
`Could not Connect to ${connectionOptions.url} Unauthorized Secret`
);
}
return this.error(err);
Expand Down
12 changes: 0 additions & 12 deletions src/lib/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,3 @@ export function runQueries(expressions, client) {
return promiseSerial(wrapQueries(expressions, client));
}
}

export function stringifyEndpoint(endpoint) {
var res = "";
if (endpoint.scheme) {
res += endpoint.scheme + "://";
}
res += endpoint.domain;
if (endpoint.port) {
res += ":" + endpoint.port;
}
return res;
}

0 comments on commit b5f7a37

Please sign in to comment.