Edgio

Updating Edgio Packages

This guide outlines how to update Edgio packages using our CLI - covering version updates, dependency synchronization, and adjustments needed for compatibility across minor versions.

Updating Your Project

To update your project to the latest version of Edgio, run the following command within the root directory of your project:
Bash
1npx @edgio/cli use latest
This command will use the latest version of Edgio available on npm. If you want to use a specific version, you can specify it as follows:
Bash
1npx @edgio/cli use 7.2.0

Verifying the Update

After updating your project, compare the dependency versions in your package.json file under the @edgio namespace. Ensure that all dependencies are using the same version. For example:
JSON
1"devDependencies": {
2 "@edgio/cli": "^7.2.5",
3 "@edgio/core": "^7.2.5",
4 "@edgio/devtools": "^7.2.5",
5 "@edgio/next": "^7.2.5",
6 "@edgio/prefetch": "^7.2.5",
7 "@edgio/react": "^7.2.5",
8 /* ... */
9}
The @edgio/rum package dependency is not automatically updated or synchronized with other @edgio dependencies. If you are using this package, you must use a package manager to update this dependency manually.

Edgio v7.2 Changes

Edgio v7.2.0 introduces support for ESM-based user projects which may require some changes to your project.

External Dependencies in routes.js

If your routes.js file is loading external dependencies that are copied to the .edgio build folder, you may need to adjust the relative paths of imported assets based on their location.
For example:
JavaScript
1require('server.js')
Should change to:
JavaScript
1require(join(process.cwd(), 'server.js'))

Version Sync of @edgio Packages

Errors such as TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined might occur after updating Edgio packages. Often, these arise because versions of the @edgio/ packages aren’t synchronized. Ensure all related packages in package.json have consistent versions:
JSON
1"devDependencies": {
2 "@edgio/cli": "^7.2.0",
3 "@edgio/core": "^7.2.0",
4 "@edgio/astro": "^7.2.0",
5}
Fixing version sync issues may require deleting the node_modules directory, the package-lock.json/yarn.lock file, or both. After which, you must run the npm install or yarn install command.
If using npm/yarn workspaces, even if the versions are synchronized, you might encounter errors if the monorepo contains projects with different @edgio package versions. In such cases:
  1. Update all projects in the monorepo to use the same version range of @edgio packages.
  2. Lock the project to a specific version rather than a range. For instance, change "@edgio/core": "^7.2.0" to "@edgio/core": "7.2.0".

Edgio Connectors

If your project uses a connector in edgio.config.js matching @edgio/*, no changes are required. These connectors are maintained by Edgio.

Custom Connectors

If your project uses a custom connector, the following adjustments may be necessary:

build.js:

  • Use DeploymentBuilder.jsAppDir instead of DeploymentBuilder.jsDir.
  • Replace the JS_DIR constant with JS_APP_DIR.
  • Change the destination folder when copying files from .edgio/lambda to .edgio/lambda/app.

prod.js:

Convert relative paths to absolute paths when importing files:
JavaScriptprod.js (Edgio v7.1 and earlier)
1require('../server.js')
2// or
3require('server.js')
Should change to:
JavaScriptprod.js (Edgio v7.2)
1require(join(process.cwd(), 'server.js'))
2// or
3require(resolve('server.js'))

Working Path in Lambda:

The working path for the Lambda bundle has changed. If your project is referencing this path, you will need to update it. In most cases, this would only be necessary if you are using a custom connector.
  • Old Path: .edgio/lambda
  • New Path: .edgio/lambda/app