neondatabase / serverless

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

Json fields returning as string and not object #88

Closed taylormm closed 1 month ago

taylormm commented 1 month ago

When using the neon adapter the Json fields are returning as strings and not as objects.

jawj commented 1 month ago

@taylormm Could you post some code that demonstrates the problem?

I just checked this and couldn't reproduce for either the http or WebSocket transports:

% deno repl

> let { neon, Pool } = await import('npm:@neondatabase/serverless')

> let sql = neon('postgresql://...')
> await sql`SELECT '{ "a": 12 }'::jsonb AS obj`
[ { obj: { a: 12 } } ]

> let pool = new Pool({ connectionString: 'postgresql://...' })
> await pool.query(`SELECT '{ "a": 12 }'::jsonb AS obj`)
Result {
  command: "SELECT",
  rowCount: 1,
  oid: null,
  rows: [ { obj: { a: 12 } } ],
  ...
}
taylormm commented 1 month ago

i was using @prisma/adapter-neon": "^5.16.1" and "@prisma/client": "^5.14.0". im happy to say the issue disappeared after upgrading both to 5.16.2.