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
I'll let the Nest maintainers comment on using environment variables in the Cron decorator. However, this may be due to the AppService decorators being loaded before the ConfigModule loads the .env file.
Here's a workaround using the dynamic scheduler API in the meantime:
I'll let the Nest maintainers comment on using environment variables in the Cron decorator. However, this may be due to the AppService decorators being loaded before the ConfigModule loads the .env file.
Is there an existing issue for this?
Current behavior
When using the @Cron function to create a scheduled job, it fails to read variables from env. I
Minimum reproduction code
https://github.com/Mortefal/cron-proof
Steps to reproduce
npm i
.env
file and addCRON_TEST_STRING
with a valid cron value. eg.*/10 * * * * *
node_modules\cron\dist\time.js:360 source = source.toLowerCase(); ^ TypeError: Cannot read properties of undefined (reading 'toLowerCase')
Where i would expect it to register both cron jobs in
app.service.ts
.Expected behavior
Where i would expect it to register both cron jobs in
app.service.ts
.Seems like the @Cron function runs without access to the process.env
Package version
^4.0.0
NestJS version
^10.0.0
Node.js version
v18.12.1
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: