Error: plugin must be a function or a promise
Jaynarol opened this issue · 1 comments
Jaynarol commented
Title says it all - I'm trying to register the plugin in the following way, as per the docs:
fastify.register(require('fastify-cron'), {
jobs: [
{
cronTime: '50 * * * *',
onTick: someFunction,
startWhenReady: true
}
]
})
franky47 commented
The docs use the TypeScript import
style, if you want to use require
, you'll need to specify the default export:
fastify.register(require('fastify-cron').default, {
jobs: [
{
cronTime: '50 * * * *',
onTick: someFunction,
startWhenReady: true
}
]
})