You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for forking this, it's solved some issues I was having with the original package.
One thing I can't get to work is agendash via Fastify which was working previously.
The error I get is about the collection being undefined.
(node:41832) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'collection' of undefined
at getOverview (C:\ProtempoCoding\job.scraping.manager\node_modules\agendash\lib\controllers\agendash.js:125:43)
at api (C:\ProtempoCoding\job.scraping.manager\node_modules\agendash\lib\controllers\agendash.js:262:7)
at Object.<anonymous> (C:\ProtempoCoding\job.scraping.manager\node_modules\agendash\lib\middlewares\fastify.js:27:33)
at preHandlerCallback (C:\ProtempoCoding\job.scraping.manager\node_modules\fastify\lib\handleRequest.js:126:28)
at preValidationCallback (C:\ProtempoCoding\job.scraping.manager\node_modules\fastify\lib\handleRequest.js:109:5)
at handler (C:\ProtempoCoding\job.scraping.manager\node_modules\fastify\lib\handleRequest.js:72:7)
at handleRequest (C:\ProtempoCoding\job.scraping.manager\node_modules\fastify\lib\handleRequest.js:20:5)
at runPreParsing (C:\ProtempoCoding\job.scraping.manager\node_modules\fastify\lib\route.js:451:5)
at Object.routeHandler [as handler] (C:\ProtempoCoding\job.scraping.manager\node_modules\fastify\lib\route.js:409:7)
at Router.lookup (C:\ProtempoCoding\job.scraping.manager\node_modules\find-my-way\index.js:378:14)
(node:41832) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
It worked fine on the standard agenda setup. I'm thinking it's likely to do with the increased mongodb sdk version?
Here is some example code.
import { Agenda } from "@hokify/agenda";
import config from "config";
const Agendash = require("agendash");
const Fastify = require("fastify");
const mongoConnectionStringAgenda: string = config.get("agenda.db.uri");
const agenda = new Agenda({
db: { address: mongoConnectionStringAgenda, collection: "agendaJobs" },
});
const fastify = new Fastify();
fastify.register(Agendash(agenda, { middleware: "fastify" }));
agenda.define(
"start company jobs",
async (job) => {
console.log(job)
},
{ priority: 20 }
);
// Get jobs on first run
async function init() {
// Start web server for monitoring
await fastify.listen(3002);
console.log("Listening on port 3002");
// Start agenda process
await agenda.start();
console.log("Agenda started");
await agenda.purge();
// Start jobs
agenda.now("start company jobs", {});
}
init();
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
Thanks for forking this, it's solved some issues I was having with the original package.
One thing I can't get to work is agendash via Fastify which was working previously.
The error I get is about the collection being undefined.
It worked fine on the standard agenda setup. I'm thinking it's likely to do with the increased mongodb sdk version?
Here is some example code.
Thanks
The text was updated successfully, but these errors were encountered: