Skip to content

Commit

Permalink
fix(cubestore-driver): Compatibility with Node.js 18 (localhost resol…
Browse files Browse the repository at this point in the history
…ved to ipv6)
  • Loading branch information
ovr committed Mar 14, 2024
1 parent ab8e176 commit f7a4fab
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/cubejs-cubestore-driver/src/CubeStoreDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ export class CubeStoreDriver extends BaseDriver implements DriverInterface {
this.config = {
batchingRowSplitCount: getEnv('batchingRowSplitCount'),
...config,
// TODO Can arrive as null somehow?
host: config?.host || getEnv('cubeStoreHost'),
port: config?.port || getEnv('cubeStorePort'),
// We use ip here instead of localhost, because Node.js 18 resolve localhost to IPV6 by default
// https://github.com/node-fetch/node-fetch/issues/1624
host: config?.host || getEnv('cubeStoreHost') || '127.0.0.1',
port: config?.port || getEnv('cubeStorePort') || '3030',
user: config?.user || getEnv('cubeStoreUser'),
password: config?.password || getEnv('cubeStorePass'),
};
this.baseUrl = (this.config.url || `ws://${this.config.host || 'localhost'}:${this.config.port || '3030'}/`).replace(/\/ws$/, '/').replace(/\/$/, '');
this.baseUrl = (this.config.url || `ws://${this.config.host}:${this.config.port}/`).replace(/\/ws$/, '/').replace(/\/$/, '');
this.connection = new WebSocketConnection(`${this.baseUrl}/ws`);
}

Expand Down

0 comments on commit f7a4fab

Please sign in to comment.