noblesamurai/node-pg-jobs

Database details not documented; db connection silently fails

Closed this issue · 3 comments

I'm trying to use node-pg-jobs and I can't tell if I'm supposed to create the DB tables myself, or if the package is supposed to do it for me. I don't see any evidence that it's connecting to my DB, but there are no helpful error messages about the DB connection.

Is this project functional?

I don't get any errors back from pg-jobs().

The callback from jobs.process(worker, callback) is called immediately, but with no parameters passed. According to the docs this means job processing has stopped, but I have no idea why.

Calling jobs.create(myJobObject, null, callback) -> Callback is called without invoking the worker, and it returns the following error object:

{ [error: relation "job_snapshots" does not exist]
   name: 'error',
   length: 105,
   severity: 'ERROR',
   code: '42P01',
   detail: undefined,
   hint: undefined,
   position: '13',
   internalPosition: undefined,
   internalQuery: undefined,
   where: undefined,
   schema: undefined,
   table: undefined,
   column: undefined,
   dataType: undefined,
   constraint: undefined,
   file: 'parse_relation.c',
   line: '1159',
   routine: 'parserOpenTable' }

This error, along with the fact that the job_snapshots table does not exist in my DB, leads me to believe there is no DB connection happening.

How can I troubleshoot this? Also, some documentation of the DB interactions / instructions would be helpful.

@jonathan-stone You have to run the migrations yourself. Ideally perhaps it would just run them for you... PRs welcome :) https://github.com/noblesamurai/node-pg-jobs#running-migrations

Thanks for the reply, that's helpful. I think this was more of a documentation issue than a bug, though it would indeed be nice for the database to be created automatically.

I must not have understood that "running migrations" meant "create the jobs database / tables." Sounds like that is a required part of the setup process. As a result I ended up using Kue instead of node-pg-jobs.

Thanks for clarifying @jonathan-stone. I've updated the README to make it a little clearer. All the best!