{"id":"bb3e70ef8e3a0665","repo":"drizzle-team/drizzle-orm","slug":"invalid-arguments-expected-a-connection-string-or","errorCode":null,"errorMessage":"Invalid arguments. Expected a connection string or a config object.","messagePattern":"Invalid arguments\\. Expected a connection string or a config object\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-orm/src/netlify-db/driver.ts","lineNumber":256,"sourceCode":"\n\t\tif (client) {\n\t\t\tif ('driver' in client) {\n\t\t\t\tif (client.driver === 'serverless') {\n\t\t\t\t\treturn construct(client.httpClient, client.pool, drizzleConfig);\n\t\t\t\t}\n\t\t\t\treturn drizzleNodePg({ client: client.pool, ...drizzleConfig }) as any;\n\t\t\t}\n\t\t\treturn construct(client.http, client.pool, drizzleConfig);\n\t\t}\n\n\t\tconst connectionString = typeof connection === 'string' ? connection : connection!.connectionString;\n\t\tconst httpClient = neon(connectionString);\n\t\tconst pool = new Pool({ connectionString });\n\n\t\treturn construct(httpClient, pool, drizzleConfig) as any;\n\t}\n\n\tthrow new Error('Invalid arguments. Expected a connection string or a config object.');\n}\n\nexport namespace drizzle {\n\texport function mock<\n\t\tTSchema extends Record<string, unknown> = Record<string, never>,\n\t>(\n\t\tconfig?: DrizzleConfig<TSchema>,\n\t): NetlifyDbDatabase<TSchema> & {\n\t\t$client: '$client is not available on drizzle.mock()';\n\t} {\n\t\treturn construct({} as any, {} as any, config) as any;\n\t}\n}\n","sourceCodeStart":238,"sourceCodeEnd":270,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-orm/src/netlify-db/driver.ts#L238-L270","documentation":"An Error 'Invalid arguments. Expected a connection string or a config object.' thrown at the end of the netlify-db drizzle() factory (drizzle-orm/src/netlify-db/driver.ts:256). It is the terminal fallback after every recognised argument shape (zero-arg env-based, string connection string, isConfig object) has been tried. Reaching it means the arguments matched none of the overloads.","triggerScenarios":"Calling drizzle() from drizzle-orm/netlify-db with an argument that is neither a string, a config object ( recognised by isConfig), nor empty. Examples: drizzle(123), drizzle(somePool) where the pool lacks the expected shape, drizzle(true), or a config object that does not pass isConfig.","commonSituations":"Passing a raw Postgres Pool/Client directly (netlify-db expects { client } or { connection } or a connection string), passing a non-string/non-object, or calling without NETLIFY_DATABASE_URL set in the zero-arg form on a non-Netlify host (getDatabase() would throw earlier, but malformed args reach this fallback).","solutions":["Pass a connection string: drizzle(process.env.NETLIFY_DATABASE_URL!).","Or pass a config: drizzle({ connection: process.env.NETLIFY_DATABASE_URL!, schema }).","Or pass a DrizzleClient: drizzle({ client: { driver: 'serverless', httpClient, pool } }).","If relying on zero-config, ensure you are on Netlify with the DB linked (no args) instead of passing a bad value."],"exampleFix":"// before\nimport { drizzle } from 'drizzle-orm/netlify-db';\nconst db = drizzle(somePgPool); // not a recognised shape -> throws\n\n// after\nconst db = drizzle(process.env.NETLIFY_DATABASE_URL!, { schema });\n// or\nconst db = drizzle({ connection: process.env.NETLIFY_DATABASE_URL!, schema });","handlingStrategy":"validation","validationCode":"function isValidNetlifyArgs(params: unknown[]): boolean {\n  const [a] = params;\n  if (params.length === 0) return true; // zero-config via env\n  if (typeof a === 'string') return true;\n  if (a && typeof a === 'object' && ('connection' in a || 'client' in a || 'schema' in a || 'casing' in a)) {\n    return true;\n  }\n  return false;\n}\n\nif (!isValidNetlifyArgs(params)) {\n  throw new Error('Pass a connection string or a config object to drizzle().');\n}","typeGuard":"function isStringOrConfig(a: unknown): boolean {\n  return typeof a === 'string' || (a !== null && typeof a === 'object');\n}","tryCatchPattern":null,"preventionTips":["Always pass a connection string or a config object to netlify-db drizzle().","Wrap drizzle() construction in a factory that type-checks arguments.","Do not pass raw pg Pool/Client instances; use { client } or { connection }."],"tags":["netlify-db","config","driver","init","validation"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}