{"id":"c5f9fe15194aac5c","repo":"drizzle-team/drizzle-orm","slug":"streaming-is-not-supported-by-the-singlestore-prox","errorCode":null,"errorMessage":"Streaming is not supported by the SingleStore Proxy driver","messagePattern":"Streaming is not supported by the SingleStore Proxy driver","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-orm/src/singlestore-proxy/session.ts","lineNumber":168,"sourceCode":"\t\t\t\treturn returningResponse;\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}\n\n\t\tconst { rows } = await client(queryString, params, 'all');\n\n\t\tif (customResultMapper) {\n\t\t\treturn customResultMapper(rows);\n\t\t}\n\n\t\treturn rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));\n\t}\n\n\toverride iterator(\n\t\t_placeholderValues: Record<string, unknown> = {},\n\t): AsyncGenerator<T['iterator']> {\n\t\tthrow new Error('Streaming is not supported by the SingleStore Proxy driver');\n\t}\n}\n\nexport interface SingleStoreRemoteQueryResultHKT extends SingleStoreQueryResultHKT {\n\ttype: SingleStoreRawQueryResult;\n}\n\nexport interface SingleStoreRemotePreparedQueryHKT extends SingleStorePreparedQueryHKT {\n\ttype: PreparedQuery<Assume<this['config'], SingleStorePreparedQueryConfig>>;\n}\n","sourceCodeStart":150,"sourceCodeEnd":179,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-orm/src/singlestore-proxy/session.ts#L150-L179","documentation":"Thrown by PreparedQuery.iterator (singlestore-proxy/session.ts:168). The proxy driver issues whole-result requests over the remote callback and has no streaming protocol, so async iteration over result rows is not possible; calling .iterator() (or for-await on the query) is rejected.","triggerScenarios":"Calling db.select(...).iterator() or `for await (const row of db.select(...))` on a database built with drizzle-orm/singlestore-proxy; using streaming to handle large result sets in an edge/proxy deployment.","commonSituations":"Porting streaming code from the node mysql2 driver to the proxy driver; memory-conscious large exports that rely on iterator() in a serverless function.","solutions":["Replace iteration with execute()/all() and process the full result array, paginating via LIMIT/OFFSET or keyset pagination for large sets.","Switch to a streaming-capable driver if true streaming is required.","Cap result size with .limit() and loop in application code over paginated batches."],"exampleFix":"// before (proxy driver)\nfor await (const row of db.select().from(bigTable)) { handle(row); }\n// after\nconst pageSize = 1000;\nlet offset = 0;\nwhile (true) {\n  const rows = await db.select().from(bigTable).limit(pageSize).offset(offset);\n  if (!rows.length) break;\n  for (const row of rows) handle(row);\n  offset += pageSize;\n}","handlingStrategy":"type-guard","validationCode":"function driverSupportsStreaming(db) {\n  return !/SingleStoreRemoteSession|SingleStoreProxy/.test(db?.session?.constructor?.name ?? '');\n}\nif (!driverSupportsStreaming(db)) {\n  // use pagination instead of iterator()\n}","typeGuard":"function isProxyDriver(db) {\n  return /SingleStoreRemoteSession|SingleStoreProxy/.test(db?.session?.constructor?.name ?? '');\n}","tryCatchPattern":null,"preventionTips":["Use execute() + LIMIT/OFFSET pagination instead of iterator() on the proxy driver.","Detect the driver and choose streaming vs pagination accordingly.","Cap page size to bound memory in serverless environments."],"tags":["streaming","iterator","proxy","singlestore","unsupported","pagination"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}