libsql-client-ts icon indicating copy to clipboard operation
libsql-client-ts copied to clipboard

Fetching too many rows results in RESPONSE_TOO_LARGE

Open mdashlw opened this issue 1 year ago • 4 comments

await client.execute("SELECT * FROM ...");

throws

file:///C:/Users/mdash/Documents/.../node_modules/@libsql/client/lib-esm/hrana.js:257
        return new LibsqlError(e.message, code, undefined, e);
               ^

LibsqlError: RESPONSE_TOO_LARGE: Response is too large
    at mapHranaError (file:///C:/Users/mdash/Documents/.../node_modules/@libsql/client/lib-esm/hrana.js:257:16)
    at HttpClient.execute (file:///C:/Users/mdash/Documents/.../node_modules/@libsql/client/lib-esm/http.js:56:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at <anonymous> (...) {
  code: 'RESPONSE_TOO_LARGE',
  rawCode: undefined,
  [cause]: [ResponseError: Response is too large] {
    code: 'RESPONSE_TOO_LARGE',
    proto: { message: 'Response is too large', code: 'RESPONSE_TOO_LARGE' }
  }
}

Node.js v20.10.0

I have 2.4M rows total 180 MB. This isn't that much, the library is supposed to handle it.

mdashlw avatar Mar 18 '24 05:03 mdashlw

file:///home/noext/Dev/track/node_modules/.pnpm/@[email protected]/node_modules/@libsql/client/lib-esm/hrana.js:268
        return new LibsqlError(e.message, code, undefined, e);
               ^

LibsqlError: RESPONSE_TOO_LARGE: Response is too large
    at mapHranaError (file:///home/noext/Dev/track/node_modules/.pnpm/@[email protected]/node_modules/@libsql/client/lib-esm/hrana.js:268:16)
    at file:///home/noext/Dev/track/node_modules/.pnpm/@[email protected]/node_modules/@libsql/client/lib-esm/http.js:76:23
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async eval (/home/noext/Dev/track/src/server/api/routers/session.ts:19:21) {
  code: 'RESPONSE_TOO_LARGE',
  rawCode: undefined,
  [cause]: [ResponseError: Response is too large] {
    code: 'RESPONSE_TOO_LARGE',
    proto: { message: 'Response is too large', code: 'RESPONSE_TOO_LARGE' }
  }
}

got the same issue with a query that return multiple blob rows of 2mb, working great with drizzle studio on turso admin

Noext avatar Oct 23 '24 06:10 Noext

6 | rawCode; 7 | constructor(message, code, rawCode, cause) { 8 | if (code !== undefined) { 9 | message = ${code}: ${message}; 10 | } 11 | super(message, { cause }); ^ LibsqlError: RESPONSE_TOO_LARGE: Response is too large code: "RESPONSE_TOO_LARGE"

  at new LibsqlError (/home/node/app/node_modules/@libsql/core/lib-esm/api.js:11:9)
  at mapHranaError (/home/node/app/node_modules/@libsql/client/lib-esm/hrana.js:268:16)
  at /home/node/app/node_modules/@libsql/client/lib-esm/http.js:76:23

1 | /** Generic error produced by the Hrana client. / 2 | export class ClientError extends Error { 3 | /* @private */ 4 | constructor(message) { 5 | super(message); ^ ResponseError: Response is too large code: "RESPONSE_TOO_LARGE"

  at /home/node/app/node_modules/@libsql/hrana-client/lib-esm/errors.js:5:9

CarmeloCampos avatar Jan 04 '25 05:01 CarmeloCampos

A shame there hasn't at least been acknowledgement of this issue by the maintainers. Looks like might need to switch to Postgres.

candidia avatar Mar 06 '25 07:03 candidia

A shame there hasn't at least been acknowledgement of this issue by the maintainers. Looks like might need to switch to Postgres.

The only thing I did was to make smaller requests in a for, a bit horrible but well, solution.

CarmeloCampos avatar Mar 06 '25 20:03 CarmeloCampos