What you’ll learn
  • how to upgrade Webiny from 5.8.0 to 5.9.0
Before continuing, make sure to take the necessary precautions, listed in the Overview section.
Make sure to check out the 5.9.0 changelog to get familiar with all the changes introduced in this release.

1. Project Preparation
anchor

First, we need to prepare your project for the upgrade process. With security packages refactor, some packages no longer exist, and if we try to upgrade dependencies straight away, yarn will complain. To fix that, we need to clean up your project first, to eliminate references to those deprecated packages.

In your project root, run the following:

npx https://gist.github.com/Pavel910/abc4c063eae8c18754d6a026d1fc1d06

2. Upgrade Webiny Packages
anchor

We’re now ready to upgrade all @webiny/* packages! Run the following command:

yarn up "@webiny/*@5.9.0"

Once the upgrade has finished, running the yarn webiny --version command in your terminal should return 5.9.0.

Before moving on, make sure you commit all your changes.

3. Run the Upgrade Command
anchor

Now let’s run the project upgrade:

yarn webiny upgrade 5.9.0

The upgrade script will make a couple of changes to your existing API project application’s code (located within the api folder). Once the upgrade command has finished, you can run the git status external link command to see all changes that the command performed.

4. Post Upgrade Script
anchor

To finalize the upgrade, run the following command:

npx https://gist.github.com/Pavel910/4a7a9694945fffcc65b293de8091116b

This takes care of a small glitch in the upgrade process, which we noticed after we released the 5.9.0 code. Gists to the rescue!

5. Deploy Your Project
anchor

Finally, proceed by redeploying your Webiny project:

# Execute in your project root.
yarn webiny deploy --env {environment}
As stated in the Upgrade Webiny section, we recommend that you first deploy your changes into one of your pre-production environments, like dev or staging.
Learn more about different deployment environments in the CI/CD / Environments key topic.

Additional Steps and Notes
anchor

GraphQL API Package Scaffold
anchor

If you’ve been using the GraphQL API Package scaffold in your Webiny project prior to the 5.9.0 release, you will have to revisit the created types.ts external link file for each created package, and replace the following line:

import { TenancyContext } from "@webiny/api-security-tenancy/types";

Replace it with the following import statement:

import { TenancyContext } from "@webiny/api-tenancy/types";

This change is required simply because the @webiny/api-security-tenancy package doesn’t exist anymore. Note that the new @webiny/api-tenancy package should already exist in your project, so there’s no need to add it manually.