neondatabase / serverless

Connect to Neon PostgreSQL from serverless/worker/edge functions
https://www.npmjs.com/package/@neondatabase/serverless
MIT License
318 stars 11 forks source link

NeonDbError: response too large #41

Closed maccman closed 11 months ago

maccman commented 11 months ago

Steps to reproduce

I'm just doing a select query for 200 rows.

Expected result

It works.

Actual result

I'm getting a NeonDbError: response too large error.

Environment

This is my config

import { neonConfig } from '@neondatabase/serverless'
import { CamelCasePlugin, Kysely } from 'kysely'
import { NeonHTTPDialect } from 'kysely-neon'

import { assertString } from '@/lib/assert'

import { DB } from './schema'

// Are we in a Node.js environment?
if (typeof WebSocket === 'undefined') {
  neonConfig.webSocketConstructor = require('ws')
}

assertString(process.env.DATABASE_URL, 'DATABASE_URL is not set')

export const db = new Kysely<DB>({
  dialect: new NeonHTTPDialect({
    connectionString: process.env.DATABASE_URL,
  }),
  plugins: [new CamelCasePlugin()],
})

Logs, links

jawj commented 11 months ago

Our current maximum response size over HTTP is 1MB, so I guess these are fairly big rows?

I'll discuss with the team whether we can raise this limit.

maccman commented 11 months ago

Got it - is this documented anywhere?

jawj commented 11 months ago

OK, we've raised the response limit to 10MB: https://github.com/neondatabase/neon/pull/4961/files. This will become effective when we next deploy an update, which is usually fairly frequent.

In the meantime, or if 10MB is still not enough, connections using the Client and Pool objects (which send data over WebSockets instead of plain http) are not subject to this limit.

The limit is now mentioned in the error message itself. Since I suspect we'll be raising the limit again before too long, I'm not sure we'll want to document it elsewhere just yet.