Google Cloud Tasks

Google Cloud Tasks

Job Queue implementation using Google Cloud Tasks to push jobs to your worker instance

npm install @pinelab/vendure-plugin-google-cloud-tasks
Latest version1.8.0
Compatibility>=2.2.0
Last publishedDec 20, 2024
Pinelab
PinelabWebshops for mission-driven brands and wholesalers

Official documentation here

Plugin for using Vendure worker with Google Cloud Tasks. This plugin will show ending, successful and failed jobs in the admin UI under sytem/jobs, but not running jobs. Only jobs of the past 7 days are kept in the DB.

Getting started

Plugin setup

  1. Remove DefaultJobQueuePlugin from your vendure-config. Add this plugin to your vendure-config.ts:
  1. Start the Vendure server, log in to the admin dashboard and trigger a reindex job via Products > (cog icon) > reindex to test the Cloud Tasks Plugin.

You can call the endpoint /cloud-tasks/clear-jobs/X with the secret as Auth header to clear jobs older than X days. For example:

Will clear all jobs older than 1 day.

<!-- (Use this to edit the diagram on plantuml.com: `//www.plantuml.com/plantuml/png/jL0zJyCm4DtzAzu8Kf2wi7H0HHsec4h9ZanyQGqN6tntLFdtEAb49If6Dkjz-DvxAr5Vr0PsRitPGklbNHxpwvEHqRCMhxGVSNE7X_NsvNC2bxWF0LK2pPWHzyDDmlCt6vy2KrbYQtB0MtLyHOzDssxTXUWFv_o8QO_UHwRGG38AQHbn5NjuLHe-LC3KQuEi1oh7A0JE9uSLWfSfx8wwNCBrvU5VtNQaLXBgAcg2syMYmJm5Zf4PbWALogM0g4X4uPIc9lpl4GXYNKSYlJ6FpLJntCkv5QLW0ty3`) -->

DEADLINE_EXCEEDED errors when pushing tasks to queue

When pushing multiple tasks concurrently to a queue in serverless environments, you might see DEADLINE_EXCEEDED errors. If that happens, you can instantiate the plugin with fallback: true to make the Google Cloud Tasks client fallback to HTTP instead of GRPC. For more details see https://github.com/googleapis/nodejs-tasks/issues/397#issuecomment-618580649

Request entity too large

This means the Job data is larger than NestJS's configured request limit. You can set a large limit in your vendure-config.ts:

We don't include this in the plugin, because it affects the entire NestJS instance