Skip to content

Syntax Error with postgresjs library #827

Description

@abdulrahman1s

Description:

The latest release has caused an issue with the postgres.js library.

Steps to reproduce:

  1. Import the postgres npm package in the script being executed.
  2. Run node --import @swc-node/register/esm-register script.ts

Environment:

  • Node.js version: v20.11.1
  • OS: Nixos

Error log:

node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^
[Error:   × Expected a semicolon
    ╭─[file:///home/user/github/project/node_modules/postgres/src/large.js:7:1]
  4 │   return new Promise(async(resolve, reject) => {
  5 │     await sql.begin(async sql => {
  6 │       let finish
  7 │       !oid && ([{ oid }] = await sql`select lo_creat(-1) as oid`)
    ·        ───
  8 │       const [{ fd }] = await sql`select lo_open(${ oid }, ${ mode }) as fd`
  9 │ 
 10 │       const lo = {
    ╰────


Caused by:
    Syntax Error] {
  code: 'GenericFailure'
}

Code snippet:

import postgres from 'postgres'

const sql = postgres()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions