node-pg-cursor
node-pg-cursor copied to clipboard
Invalid protocol sequence 'P' while in PortalSuspended state (Redshift)
We're encountering an issue with cursors on Redshift, which seems to manifest itself specifically when we only request a single row from the cursor. Requesting more than 1 seems to be working fine and as expected.
The full error:
{ error: Invalid protocol sequence 'P' while in PortalSuspended state.
at Connection.parseE (.../node_modules/pg/lib/connection.js:604:11)
at Connection.parseMessage (.../node_modules/pg/lib/connection.js:401:19)
at TLSSocket.<anonymous> (.../node_modules/pg/lib/connection.js:121:22)
at TLSSocket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at TLSSocket.Readable.push (_stream_readable.js:219:10)
at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 143,
severity: 'ERROR',
code: 'XX000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: '/home/ec2-user/padb/src/sys/xen_execute.cpp',
line: '8205',
routine: 'pg_throw' }
We're not 100% convinced that just requesting always a minimum of 2 rows is necessarily a real fix for this, so would love to hear any thoughts if you have them! It's also somewhat flaky, it doesn't always happen, and happens for a mixture of different query types.