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
1npm i -g @edgio/cli
Or with yarn
1yarn global add @edgio/cli
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:
1edgio use latest
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
Name | Description |
---|---|
--skip-framework | Alias: “-s”. Skips the framework (Next.js, Vue, Angular, etc..) build and simply rebundles your router |
--disable-permanent-assets | Set this to true to suppress errors like “Immutable file (…) content was changed” during deployment. |
--include-sources | Includes 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
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
Name | Description |
---|---|
--team | (Required) The team name |
--site | (Required) The site name |
--environment | (Required) The environment name |
--path | A path to clear. Use ”*” as a wildcard |
--surrogate-key | Clears all responses assigned to the specified surrogate key (cache tag) |
Example
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
1edgio completion
Using ZSH
1edgio completion >> ~/.zshrc
Using BASH
1edgio completion >> ~/.bashrc
config
Sets configuration options for this property.
set-analytics
Command | Description |
---|---|
set-analytics | Set this to false to prevent sending usage data. Optionally, you may set the environment variable EDGIO_DISABLE_ANALYTICS=1 . |
Example
1edgio config set-analytics false
set-backend
Command | Description |
---|---|
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
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
Name | Description |
---|---|
--json | Outputs the response variables in JSON format, including telemetry data, headers, cookies, and the body (if using --show-body ) [default: false] |
--debug | Run in verbose mode. This has no effect when using with --json option. |
--save-body | Writes the response body to a temporary file path which is set in the output. This has no effect when using with --json option. |
--show-body | Prints the response body in the output. [default: false] |
--help | View help information for options to the curl command. |
Example
1➜ ~ edgio curl https://docs.edg.io23URL : https://docs.edg.io/ 🔗4From: 127.0.0.1:57412 🖥️5To : 208.69.180.12:443 🌎67HTTP/2 2008Response Headers9 accept-ranges: bytes10 age: 32160911 cache-control: private, no-store, no-cache12 content-length: 38981513 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.com14 content-type: text/html15 date: Thu, 24 Nov 2022 22:20:15 GMT16 etag: "efb94304e92947a7e4732c90b8a4d58f"17 last-modified: Thu, 24 Nov 2022 00:58:08 GMT18 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; HttpOnly20 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; preload23 vary: accept-encoding, user-agent24 via: 1.1 varnish (Varnish/6.6), HTTP/1.1 Layer025 x-0-cache-hash: bbd8d015dfd26d59408cef5c6d927011298f67e6b11ca4d5316d69482104e85326 x-0-caching-status: ok27 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=static28 x-0-status: eh=200,gd=200,p=20029 x-0-t: eh=3,ect=2,ecc=hit30 x-0-version: 2881 5.0.3 18 2022-11-24T00:58:26.355Z 1.7.331 x-request-id: 9f3925df1594aa7872f3620725f123d9d449132732 x-xss-protection: 1; mode=block3334Edgio Version35 Build Number 288136 Package Version 5.0.33738Edgio Telemetry39 Edge POP total time of 3ms (eh)40 Edge POP Varnish total time of 2ms (ect)41 Edge POP caching status hit (ecc)4243 DNS Lookup TCP Connection TLS Handshake Server Processing Content Transfer44[ 327ms | 27ms | 43ms | 52ms | 95ms ]45 | | | | |46 namelookup:327ms | | | |47 connect:353ms | | |48 pretransfer:396ms | |49 starttransfer:449ms |50 total:543ms5152Response Body53 Disabled. To enable use EDGIO_CURL_SAVE_BODY=true or EDGIO_CURL_SHOW_BODY=true
deploy
Builds and deploys your site on Edgio.
Parameters
Name | Description |
---|---|
team | The 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
Name | Description |
---|---|
--site | The name of the site to deploy. By default the name field in package.json is used. |
--environment | The environment to deploy to. By default the default environment is used. |
--branch | The name of the source control branch. This is automatically set when using Git. |
--skip-build | Skips the build step |
--token | Authenticates 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-url | The 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-sources | Includes 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-assets | Set 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:
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
1edgio deploy my-team --environment=production
docs
Open the Edgio documentation in your browser.
Example
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
Name | Description |
---|---|
--cache | Enables caching during local development so that you can test the caching logic in your router. |
Example
1edgio dev
env
Manage deployed property’s environments and environment variables.
Parameters
Name | Description |
---|---|
pull <path-to-env-file> | Copy non-secret environment variables from an environment to a local .env file. |
Options
Name | Description |
---|---|
--team | The name of the team under which the site belongs. Uses private space if omitted. |
--site | Slug of the site to pull variables from. Uses package.json name property if omitted. |
--environment | Environment to pull variables from. Uses default environment if omitted. |
Example
1edgio env pull .env.local --team my-team --site my-site --environment production
init
Run in an existing app to add all required packages and files need to publish your app on Edgio
Example
1edgio init
Options
Name | Description |
---|---|
--connector | The name of a specific connector package to install, or a path to a directory that implements the connector interface. |
login
Logs into Edgio via the developer console.
Example
1edgio login
logout
Logs out of Edgio
Example
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
Name | Description |
---|---|
--production | Runs 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. |
--cache | Enables 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
1edgio run --production
Or to run a deployment bundle downloaded from Edgio Developer Console, use:
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:
1edgio use 4.10.1
To install the latest stable:
1edgio use latest
To install the latest preview:
1edgio use next
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@latest
and then run edgio init
on the project.