Skip to content

pg-native - libpq/build/Release/addon.node: undefined symbol ERR_DLOPEN_FAILED #28131

@nigrosimone

Description

@nigrosimone

What version of Bun is running?

1.3.10

What platform is your computer?

Linux x64

What steps can reproduce the bug?

package.json

{
    "name": "example",
    "version": "1.0.0",
    "main": "index.js",
    "dependencies": {
        "pg": "latest",
        "pg-native": "latest"
    },
    "sideEffects": false,
    "engines": {
        "node": ">=24"
    }
}

Dockerfile

FROM oven/bun:latest

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y install python3 libpq-dev g++ make

RUN mkdir -p /opt/test
WORKDIR /opt/test
COPY . /opt/test/

RUN bun install

EXPOSE 3000/tcp

USER bun
ENTRYPOINT [ "bun", "run", "index.js" ]

index.js

const pg = require("pg");
const pool = new pg.native.Pool()
pool.query('SELECT 1').then(console.log).catch(console.error)

output

web-1  | 107 |         return opts[p] || p;
web-1  | 108 |       })
web-1  | 109 |     );
web-1  | 110 |     tries.push(n);
web-1  | 111 |     try {
web-1  | 112 |       b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
web-1  |                                                      ^
web-1  | error: /opt/test/node_modules/libpq/build/Release/addon.node: undefined symbol: _ZN4node13EmitAsyncInitEPN2v87IsolateENS0_5LocalINS0_6ObjectEEENS3_INS0_6StringEEEd
web-1  |  code: "ERR_DLOPEN_FAILED"
web-1  |
web-1  |       at bindings (/opt/test/node_modules/bindings/bindings.js:112:48)     
web-1  |       at <anonymous> (/opt/test/node_modules/libpq/index.js:1:18)
web-1  |       at <anonymous> (/opt/test/node_modules/pg-native/index.js:1:7)
web-1  |       at <anonymous> (/opt/test/node_modules/pg/lib/native/client.js:7:3)  
web-1  |       at <anonymous> (/opt/test/node_modules/pg/lib/native/index.js:2:8)   
web-1  |       at get (/opt/test/node_modules/pg/lib/index.js:59:20)
web-1  |       at <anonymous> (/opt/test/index.js:2:18)
web-1  |                                                                            
web-1  | Bun v1.3.10 (Linux x64 baseline)
web-1 exited with code 1

What is the expected behavior?

should works

What do you see instead?

error: /opt/test/node_modules/libpq/build/Release/addon.node: undefined symbol

Additional information

pg-native

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions