← Back to the blog

Announcing Vendure v1.2

Author avatar
September 1, 2021
Michael Bromley
@michlbrmly

Vendure v1.2.0 is out now! Here’s an overview of the major new features and improvements included in this release.

v1.2.0 Changelog

Upgrading from v1.x.x

This minor release contains no breaking schema or GraphQL API changes, so updating should be a matter of changing all @vendure/... dependencies in your package.json file to 1.2.0.

{
  "dependencies": {
-    "@vendure/admin-ui-plugin": "1.1.5",
-    "@vendure/asset-server-plugin": "1.1.5",
-    "@vendure/core": "1.1.5",
-    ... etc
+    "@vendure/admin-ui-plugin": "1.2.0",
+    "@vendure/asset-server-plugin": "1.2.0",
+    "@vendure/core": "1.2.0",
+    ... etc
  },
  "devDependencies": {
-    "@vendure/testing": "1.1.5", 
+    "@vendure/testing": "1.2.0",
  }
}

Also see the Updating Vendure guide for more information.

New in v1.2

New core package: @vendure/job-queue-plugin

A brand-new core plugin package has been released which will house alternative JobQueueStrategy implementations.

As a little background, Vendure ships with the DefaultJobQueuePlugin which stores background jobs in a table in the main database. This works well for smaller projects, but at scale it can become a performance bottleneck, placing undue load on the database server.

For this reason, the @vendure/job-queue-plugin package has been created to house alternative, more scalable implementations. First up is the new BullMQJobQueuePlugin, which implements a job queue based on BullMQ, a robust, battle-tested library backed by Redis.

Future releases of this package will include implementations for the queue services offered by the major cloud providers.

Here’s a video I recorded during the development of this plugin, which goes into more detail with some rough benchmarks demonstrating the performance gains to be had by switching to Redis:

New product options editor

The Admin UI now includes a brand-new view for easily editing the details of ProductOptionGroups & ProductOptions. Previously, there was no way to edit the details of an existing option group except via the GraphQL API. Moreover, adding translations was a very time-intensive process.

This new view allows you to update everything in one place, and makes the process of translating options much faster.

The new product options editor view

The new product options editor view

More flexible session management

To manage user sessions, Vendure makes use of either cookies or bearer tokens, as defined by the authOptions.tokenMethod config option. When serving multiple clients (such as a web app and a mobile app) the choice of which method to use was sometimes not clear, as each is better suited to certain clients.

With this release, it is now possible to support both methods simultaneously, so e.g. your web storefront can use cookies, and your mobile app can use a bearer token.

const config: VendureConfig = {
  authOptions: {
    tokenMethod: ['cookie', 'bearer'],
  },
};

Better serverless worker support

The Vendure worker process is designed to run continuously, responding to and processing any new jobs that get added to the job queue. However, the worker does not run well on serverless infrastructure like Google Clould Run, since it does not accept HTTP calls and would be automatically throtted due to inactivity, even if it was actually processing jobs the whole time. You can read some in-depth discussion of this here and here.

To better support this use-case the worker can now be instantiated with a built-in HTTP server which implements a health/liveness check endpoint:

bootstrapWorker(config)
  .then(worker => worker.startJobQueue())
  .then(worker => worker.startHealthCheckServer({ port: 3020 }))
  .catch(err => {
    console.log(err);
  });

See the Deployment guide for more information.

In addition, internal refactoring of the worker has resulted in improved startup times of around 4-5x, (~2s down to ~400ms in my testing)

Elasticsearch plugin enhancements

If you are using the ElasticsearchPlugin, it is now possible to finely tune the index settings and mapping configuration. These are advanced options which unlock the full power of Elasticsearch and allow you much more control over the behaviour of the search.

In addition, improvements have been made to the way indexing is performed so that reindexing can be done in the background without affecting the current live index.

Other notable features

  • The Admin UI now supports Product & Collection slugs in non-Latin character sets, such as Cyrillic, Arabic or Chinese.
  • The Admin UI is now translated into Italian.
  • The Shop API now has new facet and facets queries to allow fetching of Facets.
  • The internal health monitor for the worker process has been restored, so you can again see the status of the worker in the Admin UI > System section.
  • Updated the Admin UI dependencies to Angular v12 and Clarity v5.5.

Thank you to our contributors

I’d like to thank the wonderful Vendure community who contribute their ideas, bug reports, and code to the project daily. This release includes contributions by:

  • Artcoded:

    • feat(admin-ui): Add admin-ui Italian translation (#998)
  • Artem Danilov:

    • feat(elasticsearch-plugin): add totalItemsMaxSize option (#977)
    • feat(elasticsearch-plugin): Add ability to customize index options and mappings
    • feat(core): Add Facet queries to Shop API (#1016)
  • Baraka Mwakish:

    • docs: Fix typo in managing-sessions.md (#1007)
  • Casuneanu Catalin:

    • fix(admin-ui): Fix Channel dropdown auto-select in Safari (#1040)
Author avatar
Written by
Michael Bromley
Michael is the creator of Vendure. He lives in Vienna, Austria.
Twitter logo GitHub logo