Edgio

CLI

This guide shows you everything you can do with the Edgio command line interface.
By default, Edgio CLI v5.1.0+ collects usage and error reporting information to help improve our products. However, it omits personally identifiable information. Learn how to opt-out.

Installation

To install, or upgrade to the latest, Edgio CLI run
Bash
1npm i -g @edgio/cli@^6.0.0
Or with yarn
Bash
1yarn global add @edgio/cli@^6.0.0

Upgrade Project to Latest Version

If you already have a project running on Edgio and you want to update packages to the most recent release of @edgio, simply run:
Bash
1edgio use ^6.0.0
Before deploying your site, verify that all functionality, including request/response data, is as expected.

Commands

build

Creates a build of your app optimized for production.

Options

NameDescription
--skip-frameworkAlias: “-s”. Skips the framework (Next.js, Vue, Angular, etc..) build and simply rebundles your router
--disable-permanent-assetsSet this to true to suppress errors like “Immutable file (…) content was changed” during deployment.
--include-sourcesIncludes all non-gitignored source files in the bundle uploaded to Edgio. This can be helpful when debugging, especially when working with Edgio support. You can limit the files that are uploaded using the sources configuration in edgio.config.js.

Example

Bash
1edgio build

cache-clear

Clears the cache. If neither --path nor --surrogate-key is specified, the entire cache for the specified environment will be cleared.

Options

NameDescription
--team(Required) The team name
--site(Required) The site name
--environment(Required) The environment name
--pathA path to clear. Use ”*” as a wildcard
--surrogate-keyClears all responses assigned to the specified surrogate key (cache tag)

Example

Bash
1edgio cache-clear --team=my-team --site=my-site --environment=production --path=/p/*

completion

Creates a script that provides autocompletion for Edgio CLI commands that can be installed in your shell.

Example

Bash
1edgio completion

Using ZSH

Bash
1edgio completion >> ~/.zshrc

Using BASH

Bash
1edgio completion >> ~/.bashrc

config

Sets configuration options for this property.

set-analytics

CommandDescription
set-analyticsSet this to false to prevent sending usage data. Optionally, you may set the environment variable EDGIO_DISABLE_ANALYTICS=1.

Example

Bash
1edgio config set-analytics false

set-backend

CommandDescription
set-backend <backend>Sets the --domainOrIp, -d and/or --hostHeader, -h to the existing <backend>
This command must be called with <backend> already existing in the edgio.config.js file. If <backend> does not exist, an error will be thrown.

Example

Bash
1edgio config set-backend origin -d docs.edg.io

curl

Uses curl to make a request to the specified URL, highlighting Edgio-specific telemetry information. See Response for more information around response headers and telemetry values.

Options

NameDescription
--jsonOutputs the response variables in JSON format, including telemetry data, headers, cookies, and the body (if using --show-body) [default: false]
--debugRun in verbose mode. This has no effect when using with --json option.
--save-bodyWrites the response body to a temporary file path which is set in the output. This has no effect when using with --json option.
--show-bodyPrints the response body in the output. [default: false]
--helpView help information for options to the curl command.

Example

Bash
1➜ ~ edgio curl https://docs.edg.io
2
3URL : https://docs.edg.io/ 🔗
4From: 127.0.0.1:57412 🖥️
5To : 208.69.180.12:443 🌎
6
7HTTP/2 200
8Response Headers
9 accept-ranges: bytes
10 age: 321609
11 cache-control: private, no-store, no-cache
12 content-length: 389815
13 content-security-policy: default-src 'self'; style-src 'unsafe-inline' 'self' fonts.googleapis.com cdn.jsdelivr.net; font-src fonts.gstatic.com; img-src 'self' www.google-analytics.com analytics.twitter.com www.facebook.com px.ads.linkedin.com *.intercomcdn.com tr.lfeeder.com data: *.moovweb.net; frame-src www.youtube.com youtu.be player.vimeo.com; script-src 'unsafe-inline' 'self' 'unsafe-eval' *.clarity.ms *.google-analytics.com *.googletagmanager.com *.hotjar.com cdn.jsdelivr.net cdn.segment.com cdn4.mxpnl.com connect.facebook.net googletagmanager.com js.intercomcdn.com player.vimeo.com px4.ads.linkedin.com s.adroll.com sc.lfeeder.com snap.licdn.com widget.intercom.io www.google-analytics.com www.googletagmanager.com www.youtube.com; base-uri 'self'; frame-ancestors 'self'; media-src www.youtube.com; connect-src *.algolia.net *.algolianet.com *.clarity.ms *.edg.io *.github.io *.google-analytics.com *.googletagmanager.com *.intercom.io *.intercomassets.com *.intercomcdn.com *.layer0-limelight.link *.layer0-perma.link *.layer0.co *.layer0.link *.segment.com *.segment.io *.vimeo.com analytics.google.com googletagmanager.com vimeo.com
14 content-type: text/html
15 date: Thu, 24 Nov 2022 22:20:15 GMT
16 etag: "efb94304e92947a7e4732c90b8a4d58f"
17 last-modified: Thu, 24 Nov 2022 00:58:08 GMT
18 server-timing: layer0-cache;desc="HIT-L1", edge_pop;desc=hef, country;desc=US, xrj;desc="%7B%22path%22%3A%22%2F%22%7D"
19 set-cookie: layer0_bucket=3; SameSite=Lax; Path=/; Max-Age=2147483647; HttpOnly
20 set-cookie: layer0_destination=default; SameSite=Strict; Path=/
21 set-cookie: layer0_environment_id_info=1162d006-8a69-4f5b-b8a9-545d801291cd; SameSite=Strict; Path=/
22 strict-transport-security: max-age=31536000; includeSubDomains; preload
23 vary: accept-encoding, user-agent
24 via: 1.1 varnish (Varnish/6.6), HTTP/1.1 Layer0
25 x-0-cache-hash: bbd8d015dfd26d59408cef5c6d927011298f67e6b11ca4d5316d69482104e853
26 x-0-caching-status: ok
27 x-0-components: eh=1.0.9,c=5.0.3,e=hef,ec=1.9.8,gd=1.4.5,p=1.31.11,b=static
28 x-0-status: eh=200,gd=200,p=200
29 x-0-t: eh=3,ect=2,ecc=hit
30 x-0-version: 2881 5.0.3 18 2022-11-24T00:58:26.355Z 1.7.3
31 x-request-id: 9f3925df1594aa7872f3620725f123d9d4491327
32 x-xss-protection: 1; mode=block
33
34Edgio Version
35 Build Number 2881
36 Package Version 5.0.3
37
38Edgio Telemetry
39 Edge POP total time of 3ms (eh)
40 Edge POP Varnish total time of 2ms (ect)
41 Edge POP caching status hit (ecc)
42
43 DNS Lookup TCP Connection TLS Handshake Server Processing Content Transfer
44[ 327ms | 27ms | 43ms | 52ms | 95ms ]
45 | | | | |
46 namelookup:327ms | | | |
47 connect:353ms | | |
48 pretransfer:396ms | |
49 starttransfer:449ms |
50 total:543ms
51
52Response Body
53 Disabled. To enable use EDGIO_CURL_SAVE_BODY=true or EDGIO_CURL_SHOW_BODY=true

deploy

Builds and deploys your site on Edgio.

Parameters

NameDescription
teamThe name of the team under which the site will be deployed. The site will be deployed to your private space will be used if omitted.

Options

NameDescription
--siteThe name of the site to deploy. By default the name field in package.json is used.
--environmentThe environment to deploy to. By default the default environment is used.
--branchThe name of the source control branch. This is automatically set when using Git.
--skip-buildSkips the build step
--tokenAuthenticates using a deploy token rather than your user credentials. Use this option when deploying from CI. Alternatively, you can also specify the deploy token by setting the EDGIO_DEPLOY_TOKEN environment variable.
--commit-urlThe URL at which the commit can be viewed in your source control provided. If your package.json provides the repository attribute the commit URL will be derived automatically if you use GitHub, GitLab, or BitBucket.
--include-sourcesIncludes all non-gitignored source files in the bundle uploaded to Edgio. This can be helpful when debugging, especially when working with Edgio support. You can limit the files that are uploaded using the sources configuration in edgio.config.js.
--disable-permanent-assetsSet this to true to suppress errors like “Immutable file (…) content was changed” during deployment.

Getting Information about the Deployment

The deploy command writes a file called .edgio/deployment-manifest.json, which contains the following information:
JavaScript
1{
2 "number": /* the deployment number */,
3 "url": /* the permalink URL for the deployment */,
4 "environment": {
5 "url": /* The edge URL for the deployment */,
6 "name": /* The name of the environment that was deployed to */
7 }
8}

Example

Bash
1edgio deploy my-team --environment=production

docs

Open the Edgio documentation in your browser.

Example

Bash
1edgio docs

dev

Runs your project in development mode, simulating the Edgio cloud environment. This command is a simplified version of edgio run, with only the —cache option being supported.

Options

NameDescription
--cacheEnables caching during local development so that you can test the caching logic in your router.

Example

Bash
1edgio dev

env

Manage deployed property’s environments and environment variables.

Parameters

NameDescription
pull <path-to-env-file>Copy non-secret environment variables from an environment to a local .env file.

Options

NameDescription
--teamThe name of the team under which the site belongs. Uses private space if omitted.
--siteSlug of the site to pull variables from. Uses package.json name property if omitted.
--environmentEnvironment to pull variables from. Uses default environment if omitted.

Example

Bash
1edgio env pull .env.local --team my-team --site my-site --environment production

init

Run this command from the root directory of your web application or website to add all packages and files required to deploy your app on Edgio.
If you are not using the latest version of Edgio, then you must specify the --edgioVersion ^6.0.0 option when running this command.

Example

Bash
1edgio init

Options

NameDescription
--connectorThe name of a specific connector package to install, or a path to a directory that implements the connector interface.
--edgioVersionThe version of Edgio to install. Defaults to latest.

login

Logs into Edgio via the developer console.

Example

Bash
1edgio login

logout

Logs out of Edgio

Example

Bash
1edgio logout

run

Runs your app locally. Uses port 3000 by default. You can change this by setting the PORT environment variable. For example: PORT=5000 edgio run.

Options

NameDescription
--productionRuns a production build of your app, simulating the cloud environment. This can also be achieved by setting the NODE_ENV environment variable to true. You need to run edgio build first.
--cacheEnables caching during local development so that you can test the caching logic in your router. By default caching is turned off in local development to ensure you don’t see stale responses as you make changes to your code.

Example

Bash
1edgio run --production
Or to run a deployment bundle downloaded from Edgio Developer Console, use:
Bash
1edgio run /path/to/bundle.zip
Production mode is always used when running downloaded bundles.

use

Switches the version of all @edgio/* packages in your project.

Example

To install a particular version:
Bash
1edgio use 6.1.0
To install the latest stable version relative to your current version:
Bash
1edgio use ^6.0.0
To install the latest preview:
Bash
1edgio use next
Using edgio use latest or edgio use next will update all @edgio/* packages in your project to the latest version published in the NPM registry. Doing so may update your project to a newer major version which may introduce breaking changes.
It is recommended you updating using the latest stable version relative to your current version

Troubleshooting


Error: Cannot find module … on edgio init

An uncommon issue when running edgio init can present a similar error:
installing @edgio/core, @edgio/cli, @edgio/prefetch, @edgio/devtools, @edgio/angular… done. Error: Cannot find module ‘/Users/myUser/Projects/my-@edgio-poc/node_modules/@edgio/angular/bin/init’
This may be related to an outdated global version of Edgio CLI. The telltale sign is reference to /bin/ in the module path. This is an old convention. Recommended approach would be to npm i -g @edgio/cli@^6.0.0 and then run edgio init on the project.