Welcome to the new Golem Cloud Docs! 👋
Documentation
Experimental Languages
JavaScript
Updating Workers

Updating workers to newer versions of JavaScript components

As described in the general Workers page, each worker runs on a specific version of the component it is based on, but it is possible to update a worker to a different version of the same component.

Automatic update

The automatic update mode has no JavaScript-specific details and works as it is described in the general Workers page.

Manual snapshot-based update

Sometimes the change between two component versions is so large that the only solution to migrate worker's state to a new version is to manually implement this state transfer.

This is done by implementing a save-snapshot function in the old component and a load-snapshot function in the new component. The snapshot is an array of bytes and it is the responsibility of the user to ensure that the snapshot is compatible between the two versions.

These functions are defined in the golem:api WIT package and must be explicitly exported from the component's world.