./nodebb build fails when pointing at a DigitalOcean managed PostgreSQL database


  • I am trying to use a managed PostgreSQL database at DigitalOcean for my instance of NodeBB. I have created a config.json file that looks like this:

    {
    	"url": "http://nodebb.local",
    	"secret": "xxxx",
    	"database": "postgres",
    	"port": [4567],
    	"postgres": {
    		"host": "xxxxx.b.db.ondigitalocean.com",
    		"port": 25061,
    		"username": "nodebb",
            "password": "xxxxxxx",
    		"database": "nodebb-pool",
            "ssl": true
    	}
    }
    

    and am trying to build an image using this Dockerfile:

    FROM nodebb/docker:latest
    
    WORKDIR /usr/src/app
    COPY config.json config.json
    
    ENV NODE_TLS_REJECT_UNAUTHORIZED=0
    
    RUN node ./nodebb build
    
    VOLUME /usr/src/app/public/uploads
    
    CMD exec node ./nodebb start
    

    on the node ./nodebb build step I get the following error(s):

    2021-02-21T01:28:50.763Z [4567/7] - error: [build] Encountered error preparing for build
    error: prepared statement "getObjectFields" already exists
        at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:278:15)
        at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
        at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
        at TLSSocket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:10:42)
        at TLSSocket.emit (events.js:315:20)
        at addChunk (internal/streams/readable.js:309:12)
        at readableAddChunk (internal/streams/readable.js:284:9)
        at TLSSocket.Readable.push (internal/streams/readable.js:223:10)
        at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)
    2021-02-21T01:28:50.763Z [4567/7] - error: [build] Encountered error during build step
    error: prepared statement "getObjectFields" already exists
        at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:278:15)
        at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
        at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
        at TLSSocket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:10:42)
        at TLSSocket.emit (events.js:315:20)
        at addChunk (internal/streams/readable.js:309:12)
        at readableAddChunk (internal/streams/readable.js:284:9)
        at TLSSocket.Readable.push (internal/streams/readable.js:223:10)
        at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)
    2021-02-21T01:28:50.763Z [4567/7] - error: error: prepared statement "getObjectFields" already exists
        at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:278:15)
        at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
        at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
        at TLSSocket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:10:42)
        at TLSSocket.emit (events.js:315:20)
        at addChunk (internal/streams/readable.js:309:12)
        at readableAddChunk (internal/streams/readable.js:284:9)
        at TLSSocket.Readable.push (internal/streams/readable.js:223:10)
        at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)
    The command '/bin/sh -c node ./nodebb build' returned a non-zero code: 1
    

    If I change the config.json to point to my local PostgreSQL instance, instead, it works fine.

    As far as I can tell, all the database objects are being correctly created both locally and at DigitalOcean. There are 6 tables created, 1 view, 1 routine, and 1 object type.

    Neither my local version of the database, nor the DB at DigitalOcean have a prepared statement called getObjectFields.

    Can anyone suggest something else to try? Thanks!

  • NodeBB

    @patrick-burrows said in ./nodebb build fails when pointing at a DigitalOcean managed PostgreSQL database:

    RUN node ./nodebb build

    Does changing this to RUN node ./nodebb build --series make any difference?

  • Global Moderator Plugin & Theme Dev

    What are you settings for the DO database? Do you have pgBouncer enabled? It appears that can cause issues:


  • @pitaj and @baris , thanks for your help.

    @baris adding --series did let the image finish building, but then it would get the error when running with ./nodebb start

    @pitaj, I changed the pgBouncer (connection pool) to "session" mode instead of "transaction" mode in the DigitalOcean settings and that seems to have allowed it to eventually run.

    I say "eventually" run because the first time I tried after making the change I got this error:

    error: error: prepared statement "getSortedSetRangeWithScoresAsc" already exists

    the second time I got this error:

    error: error: prepared statement "getObject" already exists

    and the third time it ran successfully!

    At this point I have started and stopped the docker image a couple times and it seems to be stable.

    Thanks for your help guys!

Suggested Topics

  • 1
  • 6
  • 14
  • 3
  • 82
| |