Install the Node.js microagent

  1. Review Node.js microagent compatibility to confirm that the Sqreen Microagent for Node.js is compatible with your Node.js application.
  2. Sign up to create your Sqreen account.
  3. Fetch your organization token. From the Sqreen Dashboard, access Account Settings > Environments & Tokens. Your token begins with env_org_. Take note of the token.
  4. From Terminal, install the Sqreen microagent and save it into your project.
    npm install --save sqreen
    
  5. Require the Sqreen microagent first at the top of your main script.
    require('sqreen');
    
  6. Set up your SQREEN_TOKEN in your home folder.
    cat > sqreen.json <<EOF
    {
      "app_name": "YOUR_APPLICATION_NAME",
      "token": "SQREEN_TOKEN"
    }
    EOF
    

The Sqreen Microagent for Node.js is also available at npm.

Install in multiple environments

Typically, you install the Sqreen microagent in your production environment, but you can install it in multiple environments. Use a unique name describing the application and different token for each environment such as production, staging, and development.

  1. From the Sqreen Dashboard, navigate to Account Settings > Environments & Tokens to fetch a token associated to an existing environment or add a new one.
  2. When creating a new environment, Sqreen automatically creates a new token and associates it with it. Take note of the new token.
  3. Set up your application name and SQREEN_TOKEN in the Sqreen microagent configuration file.
cat > sqreen.json <<EOF
{
    "app_name": "APP_NAME",
    "token": "SQREEN_TOKEN"
}
EOF

Installation behind a proxy

The Node.js microagent relies on a package named sq-native. When installing it, an archive is downloaded from AWS S3. Starting version 1.50.1 of sqreen, this installation can be done behind a proxy by referencing the HTTPS_PROXY or the HTTP_PROXY environment variable. Learn more on the doc of binary-downloader.

Uninstall

To uninstall the Node.js microagent, remove the sqreen microagent from your application.