#Cron schedule getting Error: Field (minute) cannot be parsed

1 messages · Page 1 of 1 (latest)

violet quest
#

Hi, I am getting this error in my development environment but not locally, I don't know how I can fix it. I tried several things but I didn't find anything concrete either.

09-29-2023 09:06:16 AM     at MapIterator.next (/app/server/node_modules/iterare/lib/map.js:13:39)
09-29-2023 09:06:16 AM     at MapIterator.iteratee (/app/server/node_modules/@nestjs/core/hooks/on-app-bootstrap.hook.js:22:43)
09-29-2023 09:06:16 AM     at SchedulerOrchestrator.onApplicationBootstrap (/app/server/node_modules/@nestjs/schedule/dist/scheduler.orchestrator.js:27:14)
09-29-2023 09:06:16 AM     at SchedulerOrchestrator.mountCron (/app/server/node_modules/@nestjs/schedule/dist/scheduler.orchestrator.js:54:18)
09-29-2023 09:06:16 AM     at Array.forEach (<anonymous>)
09-29-2023 09:06:16 AM     at /app/server/node_modules/@nestjs/schedule/dist/scheduler.orchestrator.js:56:29
09-29-2023 09:06:16 AM     at new CJ (/app/server/node_modules/cron/lib/job.js:62:19)
09-29-2023 09:06:16 AM     at new CT (/app/server/node_modules/cron/lib/time.js:96:9)
09-29-2023 09:06:16 AM     at CT._parse (/app/server/node_modules/cron/lib/time.js:727:10)
09-29-2023 09:06:16 AM     at CT._parseField (/app/server/node_modules/cron/lib/time.js:808:12)
09-29-2023 09:06:16 AM Error: Field (minute) cannot be parsed

process.env.CRON_TIME_EXPRESSION="30 10 * * *"

"@nestjs/schedule": "^3.0.4",

#

I don't know if I need to give more information, if necessary, let me know and I will give it.

merry gulch
#

process.env may not be populated by the time that the decorator applies the metadata and so it comes in as undefined. Does this need to be an env value?

violet quest
#

thanks jmcdo for the answer. I try putting onle a string, not from process.env and I get the same error. I'm trying again now

merry gulch
#

Oh interesting. If the string itself is giving an error that's rather unexpected

violet quest
#

the worst thing is that I can't debug it because it is an environment and in local it works fine 😦

#

btw, CronExpression works fine?

#

is also a string

merry gulch
#

Oh, I missed the || CronExpressions. Yeah, I would expect that to be fine overall

violet quest
#

and any information about Error: Field (minute) cannot be parsed?

merry gulch
#

I'd want to know what cron string it's currently parsing that it's having an issue with

violet quest
#

Well, apparently it still didn't throw the same error, I put CronExpressions.
I'll wait for the cron to run and I'll update the status. Thanks!