cube-js/cube · error
error.toString()
Error message
error.toString()
What it means
Not a thrown error: the POST db test-connection endpoint in DevServer catches any error thrown by driver.testConnection() (after restoring environment overrides) and returns HTTP 400 with error.toString(), marking the event 'test_database_connection_error'. It means the configured database credentials/connection failed the driver's connectivity check.
Source
Thrown at packages/cubejs-server-core/src/core/DevServer.ts:547
// Restore original env values
for (const [envName, envValue] of Object.entries(backup)) {
if (envValue === undefined) {
delete process.env[envName];
} else {
process.env[envName] = envValue;
}
}
await driver.testConnection();
this.cubejsServer.event('test_database_connection_success');
return res.json('ok');
} catch (error) {
this.cubejsServer.event('test_database_connection_error');
return res.status(400).json({
error: error.toString()
});
} finally {
if (driver && (<any>driver).release) {
await (<any>driver).release();
}
}
}
));
app.post('/playground/env', catchErrors(async (req, res) => {
let { variables = {} } = req.body || {};
if (!variables.CUBEJS_API_SECRET) {
variables.CUBEJS_API_SECRET = options.apiSecret;
}
let envs: Record<string, string> = {};View on GitHub (pinned to 7d981676b3)
Solutions
- Inspect the returned error message for the underlying cause (auth failure, unreachable host, bad port, TLS issues).
- Verify the database credentials and host configuration, including any env var overrides applied by the playground.
- Re-test after correcting the config; a success returns 'ok' with event 'test_database_connection_success'.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/cubejs-server-core/src/core/DevServer.ts:547 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/2880982ec7c10f6c.
Report an issue: GitHub.