Error deploying Rails app (It cannot seem to find Postgres library)

manojnaidu619HOBBY

a year ago

I'm trying to deploy a rails app, but it is failing due to below error in the build step. I'm using 'pg' gem.

#13 22.33 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

Jul 22 20:36:41

#13 22.33

Jul 22 20:36:41

#13 22.33 current directory: /usr/local/bundle/ruby/3.3.0/gems/pg-1.5.6/ext

Jul 22 20:36:41

#13 22.33 /usr/local/bin/ruby extconf.rb

Jul 22 20:36:41

#13 22.33 Calling libpq with GVL unlocked

Jul 22 20:36:41

#13 22.33 checking for pg_config... no

Jul 22 20:36:41

#13 22.33 checking for libpq per pkg-config... no

Jul 22 20:36:41

#13 22.33 Using libpq from

Jul 22 20:36:41

#13 22.33 checking for libpq-fe.h... no

Jul 22 20:36:41

#13 22.33 Can't find the 'libpq-fe.h header

Jul 22 20:36:41

#13 22.33 *****************************************************************************

Jul 22 20:36:41

#13 22.33

Jul 22 20:36:41

#13 22.33 Unable to find PostgreSQL client library.

Jul 22 20:36:41

#13 22.33

Solved

10 Replies

a year ago

Try adding this nixpacks.toml file to your project -

[phases.setup]
    nixPkgs = ["...", "postgresql"]

manojnaidu619HOBBY

a year ago

It is not working. Still getting the same error.



manojnaidu619HOBBY

a year ago

Here is the log file

Attachments


a year ago

You are using a Dockerfile not nixpacks, please attach the Dockerfile instead.


manojnaidu619HOBBY

a year ago

No, I’m not using docker. It’s just a plain ROR app.

Are there any additional files/config to be setup for deploying rails app?


a year ago

As per your build logs you are using a Dockerfile, please attach it.


manojnaidu619HOBBY

a year ago

My bad, I didn’t notice it. Here is the file

Attachments


a year ago

You are not installing the postgres client so therefore the postgres client would not be available to your app.


manojnaidu619HOBBY

a year ago

I managed to fix it and my app is now live, Thank you so much for helping.


Status changed to Solved brody 11 months ago