export default defineCronHandler('0 8 *', () => {
try {
console.log('I run every 8 am')
} catch (error) {
throw createError({
statusCode: 404,
statusMessage: 'Fail to run scheduler'
})
}
})
5. npm run dev
6. expected result: nuxt server running
7. actual result : [nuxt] [request error] [unhandled] [500] Cannot access 'nitroApp' before initialization
### Additional info
![image](https://github.com/hywax/nuxt-cron/assets/147123307/1858cd9f-2ddf-43aa-a412-3df4c9febd20)
👋 @fdfrontdev
Thanks for opening your first issue here!
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
Version
"nuxt": "^3.11.2", "nuxt-cron": "^1.5.1",
Describe the problem
When using the command npm run dev, expect the nuxt server to run, instead got error
steps to reproduce:
4.file : server/cron/job.ts
export default defineCronHandler('0 8 *', () => { try { console.log('I run every 8 am') } catch (error) { throw createError({ statusCode: 404, statusMessage: 'Fail to run scheduler' }) } })