Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am having an error when trying to create a simple job #2

Closed
diazod opened this issue Jun 24, 2016 · 3 comments
Closed

I am having an error when trying to create a simple job #2

diazod opened this issue Jun 24, 2016 · 3 comments

Comments

@diazod
Copy link

diazod commented Jun 24, 2016

When I run this code:

async function setupJobs() {
  const postgresURL = config.get('datasources:postgresql:url');
  const boss = new PgBoss(postgresURL);
  await boss.start();
  log.debug('Ready');
  boss.publish('work', () => {
    console.log('STUFF');
  });
}

I get:

Web server listening at: http://0.0.0.0:3000
  collectai:boot:jobs:debug Ready +0ms
Unhandled rejection error: syntax error at or near "ON"
    at [object Object].Connection.parseE (/User/Seinh/Project/node_modules/pg-boss/node_modules/pg/lib/connection.js:543:11)
    at [object Object].Connection.parseMessage (/User/Seinh/Project/node_modules/pg-boss/node_modules/pg/lib/connection.js:370:17)
    at Socket.<anonymous> (/User/Seinh/Project/node_modules/pg-boss/node_modules/pg/lib/connection.js:109:22)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at TCP.onread (net.js:523:20)
From previous event:
    at Db.execute (/User/Seinh/Project/node_modules/pg-boss/lib/db.js:36:20)
    at Db.executeSql (/User/Seinh/Project/node_modules/pg-boss/lib/db.js:27:25)
    at insertJob (/User/Seinh/Project/node_modules/pg-boss/lib/manager.js:225:29)
    at deferred (/User/Seinh/Project/node_modules/pg-boss/lib/manager.js:184:17)
From previous event:
    at Manager.publish (/User/Seinh/Project/node_modules/pg-boss/lib/manager.js:176:20)
    at PgBoss.publish (/User/Seinh/Project/node_modules/pg-boss/lib/index.js:137:41)
    at Object._callee$ (jobs.js:10:8)
    at tryCatch (/User/Seinh/Project/node_modules/regenerator-runtime/runtime.js:62:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/User/Seinh/Project/node_modules/regenerator-runtime/runtime.js:336:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/User/Seinh/Project/node_modules/regenerator-runtime/runtime.js:95:21)
    at step (/User/Seinh/Project/server/boot/jobs.js:34:191)
    at /User/Seinh/Project/server/boot/jobs.js:34:368
    at run (/User/Seinh/Project/node_modules/core-js/modules/es6.promise.js:89:22)
    at /User/Seinh/Project/node_modules/core-js/modules/es6.promise.js:102:28
    at flush (/User/Seinh/Project/node_modules/core-js/modules/_microtask.js:18:9)
    at doNTCallback0 (node.js:407:9)
    at process._tickDomainCallback (node.js:377:13)
    at process.fallback (/User/Seinh/Project/node_modules/async-listener/index.js:450:15)
@timgit
Copy link
Owner

timgit commented Jun 24, 2016

You're passing a callback function to publish instead of a data payload. You should publish an object for example, then use a callback via subscribe.

Try copying/pasting the example in the readme to make sure all is working.

I will leave this issue open until I add more error handling to this, though. Thanks!

@mwcbrent
Copy link

I'm running into the same thing running exactly what is in the readme example. I'm running Postgres 9.6.1.

@mwcbrent
Copy link

I take that back, I was running psql 9.6.1. This error will happen if you're running postgres 9.4...

timgit pushed a commit that referenced this issue Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants