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
Here's an improved version of the issue description:
Describe the bug
We followed the steps in the Vendure documentation to create a standalone script, which we were able to run successfully through the command-line interface. However, when we tried to run the same script as a cron job, we encountered several issues related to the Vendure Worker.
The script we created modifies products by creating and updating them. However, when we ran it through the cron job, it created several jobs and we started receiving error messages, such as:
[worker] error 5/15/24, 6:33 PM - [Vendure Worker] Job queue "send-email" encountered an error (set log level to Debug for trace): "No metadata for \"JobRecord\" was found."
Our second issue is that we want to apply a buffer to all these jobs. We were able to do this for the search by calling the index only at the end of the script and setting bufferUpdates to true in the Elastic search plugin. However, we are not sure how to apply the same buffer to these jobs. Again. if we run this through the CLI, it doesn't attempt to create all these jobs, or at least there are no errors such as these.
The cron job plugin created consists in two files:
cron.plugin.ts
import { ScheduleModule } from '@nestjs/schedule';
import { ImportProductsCronJob } from './services/cron-import-products.service';
import { TypeOrmHealthIndicator } from '@nestjs/terminus';
@Module({
imports: [ScheduleModule.forRoot()],
providers: [ImportProductsCronJob, TypeOrmHealthIndicator],
// compatibility: '^2.0.0',
})
export class CronJobPlugin {}
cron-import-products.service.ts
@Injectable()
export class ImportProductsCronJob {
@Cron(CronExpression.EVERY_HOUR)
async handleCron() {
console.log('Cron job is running!');
// Implement your cron job logic here
await getProductCount();
console.log('DONE');
}
}
Here's an improved version of the issue description:
Describe the bug
We followed the steps in the Vendure documentation to create a standalone script, which we were able to run successfully through the command-line interface. However, when we tried to run the same script as a cron job, we encountered several issues related to the Vendure Worker.
The script we created modifies products by creating and updating them. However, when we ran it through the cron job, it created several jobs and we started receiving error messages, such as:
[worker] error 5/15/24, 6:33 PM - [Vendure Worker] Job queue "send-email" encountered an error (set log level to Debug for trace): "No metadata for \"JobRecord\" was found."
Our second issue is that we want to apply a buffer to all these jobs. We were able to do this for the search by calling the index only at the end of the script and setting bufferUpdates to true in the Elastic search plugin. However, we are not sure how to apply the same buffer to these jobs. Again. if we run this through the CLI, it doesn't attempt to create all these jobs, or at least there are no errors such as these.
The cron job plugin created consists in two files:
cron.plugin.ts
cron-import-products.service.ts
Environment
@vendure/core version: 2.2.2
Nodejs version: v22.1.0
Database: Postgres
Config
The text was updated successfully, but these errors were encountered: