Search code examples
postgresqlsequelize.jsfeathersjsfeathers-sequelize

Strange error when initializing Postgres database in FeathersJS


I am converting a FeathersJS system from MySQL to Postgres and facing some problems.

After changing the connection string

"mysql": "mysql://user:password@server:port/database"

to

"postgres": "postgres://user:password@server:port/database"

at config/default.json, I changed the dialect from mysql to pg at feathers/sequelize.js.

But when I started with npm run dev I got the following JSON error message, never seen before.

{  
   "_bitField":18087936,
   "_fulfillmentHandler0":{  
      "name":"SequelizeConnectionError",
      "parent":{  
         "name":"error",
         "length":93,
         "severity":"FATAL",
         "code":"3D000",
         "file":"postinit.c",
         "line":"855",
         "routine":"InitPostgres"
      },
      "original":{  
         "name":"error",
         "length":93,
         "severity":"FATAL",
         "code":"3D000",
         "file":"postinit.c",
         "line":"855",
         "routine":"InitPostgres"
      }
   },
   "name":"SequelizeConnectionError",
   "parent":{  
      "name":"error",
      "length":93,
      "severity":"FATAL",
      "code":"3D000",
      "file":"postinit.c",
      "line":"855",
      "routine":"InitPostgres"
   },
   "original":{  
      "name":"error",
      "length":93,
      "severity":"FATAL",
      "code":"3D000",
      "file":"postinit.c",
      "line":"855",
      "routine":"InitPostgres"
   }
}

After researching a bit with no success, here I am to ask if someone has ever seen this message.

I already tried the dialect as pg and postgres at feathers/sequelize.js, just to check if it would make any difference, but it didn't.


Solution

  • A true beginner error! My fault!

    When I created the Postgres (Docker) container, I forgot to create the database itself!

    I created the role and gave it the needed permissions, but forgot to create the database corresponding to my connection string.

    The Postgres error code mentioned in my question (3D000) corresponds to invalid_catalog_name, i.e., no database corresponding to the connection string.

    One may easily check this at Postgres documentation, but I was mistakenly looking for this error code at FeathersJS documentation.