Prepared Statement - Neon Syntax Error

Hi there,

I am trying to use a prepared statement to run a query but am getting a syntax error. below you can see the .toSql() logged, as well as the error.

{
  sql: 'select "user_id", "advertiser_id", "partner_id", "display_name", "user_role", "email", "role_id", "created_at", "lastAudited", "lastAuditedBy", "status" from "dv360_user_profiles" where ("dv360_user_profiles"."partner_id" in ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) and "dv360_user_profiles"."status" = $12) limit $13',
  params: [
    '7', '3',
    '0', '1',
    '6', ',',
    '2', '4',
    '5', '8',
    '9', 'flagged',
    100
  ]
}
NeonDbError: db error: ERROR: syntax error at or near "$1"

Caused by:
    ERROR: syntax error at or near "$1"


here is my prepared statement:

export const userRolesPreparedStatement = db
  .select()
  .from(dv360UserProfilesTable)
  .where(
    and(
      inArray(
        dv360UserProfilesTable.partnerId,
        sql.placeholder("uniquePartnerIds")
      ),

      eq(dv360UserProfilesTable.status, "flagged")
    )
  )
  .limit(100)
  .prepare("userRoles");


I don't see anything wrong with my prepared statement. Can anyone spot what I'm doing wrong or let me know if this is a bug? Much appreciated.
Was this page helpful?