{"record":{"id":"1ad9eee3fd62b993","repo":"cube-js/cube","slug":"createoptions-dbtype-was-removed-in-v1-7-0-use-dr","errorCode":null,"errorMessage":"CreateOptions.dbType was removed in v1.7.0. Use driverFactory instead (return a DriverConfig `{ type, ... }`), or set the CUBEJS_DB_TYPE environment variable. See https://github.com/cube-js/cube/blob/master/DEPRECATION.md#dbtype","messagePattern":"CreateOptions\\.dbType was removed in v1\\.7\\.0\\. Use driverFactory instead \\(return a DriverConfig `(.+?)`\\), or set the CUBEJS_DB_TYPE environment variable\\. See https://github\\.com/cube-js/cube/blob/master/DEPRECATION\\.md#dbtype","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-server-core/src/core/OptsHandler.ts","lineNumber":65,"sourceCode":"    this.initializedOptions = this.initializeCoreOptions(options);\n  }\n\n  private decoratedFactory = false;\n\n  public isCustomDriverFactory(): boolean {\n    return !this.decoratedFactory;\n  }\n\n  /**\n   * driverFactory function result type.\n   */\n  private driverFactoryType: undefined | 'BaseDriver' | 'DriverConfig';\n\n  private initializedOptions: ServerCoreInitializedOptions;\n\n  private sanitizeOptions<T extends CreateOptions>(opts: T): T {\n    if ((opts as any).dbType) {\n      throw new Error(\n        'CreateOptions.dbType was removed in v1.7.0. ' +\n        'Use driverFactory instead (return a DriverConfig `{ type, ... }`), ' +\n        'or set the CUBEJS_DB_TYPE environment variable. ' +\n        'See https://github.com/cube-js/cube/blob/master/DEPRECATION.md#dbtype'\n      );\n    }\n\n    const validated = validateOptions(opts);\n\n    // Probed for its throw: the only consumer is per-request code (normalizeQuery)\n    getEnv('defaultTimezone');\n\n    if (\n      !this.isDevMode() &&\n      !process.env.CUBEJS_DB_TYPE &&\n      !opts.driverFactory\n    ) {\n      throw new Error(","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server-core/src/core/OptsHandler.ts#L47-L83","documentation":"sanitizeOptions (invoked from OptsHandler's constructor via options()) rejects the legacy CreateOptions.dbType option, which was removed in Cube v1.7.0. Passing dbType now aborts startup immediately with a deprecation error directing users to driverFactory or the CUBEJS_DB_TYPE env variable. This is an intentional hard break to migrate from the old option API.","triggerScenarios":"Calling cubejs-server-core's create/initialization with `dbType` in the CreateOptions object after upgrading to v1.7.0+, e.g. create({ dbType: 'postgres', ... }).","commonSituations":"Upgrading a project from pre-1.7 Cube following old tutorials/docs; copy-pasted bootstrap code; scaffolding tools that still emit dbType.","solutions":["Remove dbType from CreateOptions","Move the db type into the driverFactory return value: driverFactory: async () => ({ type: 'postgres' })","Or set the CUBEJS_DB_TYPE environment variable instead","Consult the DEPRECATION.md#dbtype section linked in the error"],"exampleFix":"// before\ncreate({ dbType: 'postgres', dbFactory: () => ({ host: 'localhost' }) })\n// after\ncreate({ driverFactory: async () => ({ type: 'postgres', host: 'localhost' }) })","handlingStrategy":"validation","validationCode":"function assertNoLegacyDbType(options) {\n  if ('dbType' in options) {\n    throw new Error('dbType was removed in v1.7.0: use driverFactory ({ type, ... }) or CUBEJS_DB_TYPE');\n  }\n}\nassertNoDbType(myCreateOptions);","typeGuard":"function usesModernDriverOptions(opts) {\n  return !('dbType' in opts) && (typeof opts.driverFactory === 'function' || !!process.env.CUBEJS_DB_TYPE);\n}","tryCatchPattern":"try {\n  const server = await create(opts);\n} catch (e) {\n  if (e.message.includes('CreateOptions.dbType was removed')) {\n    // migrate: move dbType into driverFactory return or CUBEJS_DB_TYPE\n  }\n  throw e;\n}","preventionTips":["Remove dbType from all create() calls when upgrading to v1.7.0+","Follow DEPRECATION.md#dbtype migration steps before upgrading","Search the codebase and scaffolding scripts for `dbType:` in CreateOptions","Prefer driverFactory returning a DriverConfig as the modern pattern"],"tags":["deprecation","config","breaking-change","db-type"],"backgroundTag":"removed-option-deprecated-api","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}