Giter VIP home page Giter VIP logo

apify-cli's Introduction

Apify command-line interface (Apify CLI)

npm version Build Status

Apify command-line interface (Apify CLI) helps you create, develop, build and run Apify Actors, and manage the Apify cloud platform from any computer.

Apify Actors are cloud programs that can perform arbitrary web scraping, automation or data processing job. They accept input, perform their job and generate output. While you can develop Actors in an online IDE directly in the Apify web application, for complex projects it is more convenient to develop Actors locally on your computer using Apify SDK and only push the Actors to the Apify cloud during deployment. This is where the Apify CLI comes in.

Note that Actors running on the Apify platform are executed in Docker containers, so with an appropriate Dockerfile you can build your Actors in any programming language. However, we recommend using JavaScript / Node.js, for which we provide most libraries and support.

Installation

Via Homebrew

On macOS (or Linux), you can install the Apify CLI via the Homebrew package manager.

brew install apify-cli

Via NPM

First, make sure you have Node.js version 16 or higher with NPM installed on your computer:

node --version
npm --version

Install or upgrade Apify CLI by running:

npm -g install apify-cli

If you receive an EACCES error, you might need to run the command as root:

sudo npm -g install apify-cli

Alternatively, you can use Node Version Manager (nvm) and install Apify CLI only into a selected user-level Node version without requiring root privileges:

nvm install 16
nvm use 16
npm -g install apify-cli

Finally, verify that Apify CLI was installed correctly by running:

apify --version

which should print something like:

apify-cli/0.10.0 darwin-x64 node-v16.14.2

You can also skip the manual global installation altogether and use npx apify-cli with all the following commands instead.

Basic usage

The following examples demonstrate the basic usage of Apify CLI.

Create a new actor from scratch

apify create my-hello-world

First, you will be prompted to select a template with the boilerplate for the actor, to help you get started quickly. The command will create a directory called my-hello-world that contains a Node.js project for the actor and a few configuration files.

If you decided to skip the installation and go with npx, the command will be npx apify-cli create my-hello-world.

Create a new actor from existing project

cd ./my/awesome/project
apify init

This command will only set up local actor development environment in an existing directory, i.e. it will create the .actor/actor.json file and apify_storage directory.

Before you can run your project locally using apify run, you have to set up the right start command in package.json under scripts.start. For example:

{
    ...
    "scripts": {
        "start": "node your_main_file.js",
    },
    ...
}

You can find more information about by running apify help run.

Create a new Actor from Scrapy project

If you want to run a Scrapy project on Apify platform, follow the Scrapy integration guide here.

Run the actor locally

cd my-hello-world
apify run

This command runs the actor on your local machine. Now's your chance to develop the logic - or magic 😏

Login with your Apify account

apify login

Before you can interact with the Apify cloud, you need to create an Apify account and log in to it using the above command. You will be prompted for your Apify API token. Note that the command will store the API token and other sensitive information to ~/.apify.

Push the actor to the Apify cloud

apify push

This command uploads your project to the Apify cloud and builds an actor from it. On the platform, actor needs to be built before it can be run.

Run an actor on the Apify cloud

apify call

Runs the actor corresponding to the current directory on the Apify platform.

This command can also be used to run other Actors, for example:

apify call apify/hello-world

So what's in this .actor/actor.json file?

This file associates your local development project with an actor on the Apify platform. It contains information such as actor name, version, build tag and environment variables. Make sure you commit this file to the Git repository.

For example, .actor/actor.json file can look as follows:

{
  "actorSpecification": 1,
  "name": "name-of-my-scraper",
  "version": "0.0",
  "buildTag": "latest",
  "environmentVariables": {
      "MYSQL_USER": "my_username",
      "MYSQL_PASSWORD": "@mySecretPassword"
  },
  "dockerfile": "./Dockerfile",
  "readme": "./ACTOR.md",
  "input": "./input_schema.json",
  "storages": {
    "dataset": "./dataset_schema.json"
  }
}

Dockerfile field
If you specify the path to your Docker file under the dockerfile field, this file will be used for actor builds on the platform. If not specified, the system will look for Docker files at .actor/Dockerfile and Dockerfile in this order of preference.

Readme field
If you specify the path to your readme file under the readme field, the readme at this path will be used on the platform. If not specified, readme at .actor/README.md and README.md will be used in this order of preference.

Input field
You can embed your input schema object directly in actor.json under input field. Alternatively, you can provide a path to a custom input schema. If not provided, the input schema at .actor/INPUT_SCHEMA.json and INPUT_SCHEMA.json is used in this order of preference.

Storages.dataset field
You can define the schema of the items in your dataset under the storages.dataset field. This can be either an embedded object or a path to a JSON schema file. You can read more about the schema of your actor output here.

Note on migration from deprecated config "apify.json"
Note that previously, actor config was stored in the apify.json file that has been deprecated. You can find the (very slight) differences and migration info in migration guidelines.

Environment variables

There are two options how you can set up environment variables for Actors.

Set up environment variables in .actor/actor.json

All keys from env will be set as environment variables into Apify platform after you push actor to Apify. Current values on Apify will be overridden.

{
    "actorSpecification": 1,
    "name": "dataset-to-mysql",
    "version": "0.1",
    "buildTag": "latest",
    "environmentVariables": {
      "MYSQL_USER": "my_username",
      "MYSQL_PASSWORD": "@mySecretPassword"
    }
}

Set up environment variables in Apify Console

In Apify Console select your actor, you can set up variables into Source tab. After setting up variables in the app, remove the environmentVariables from .actor/actor.json. Otherwise, variables from .actor/actor.json will override variables in the app.

{
    "actorSpecification": 1,
    "name": "dataset-to-mysql",
    "version": "0.1",
    "buildTag": "latest"
}

How to set secret environment variables in .actor/actor.json

CLI provides commands to manage secrets environment variables. Secrets are stored to the ~/.apify directory. You can add a new secret using the command:

apify secrets:add mySecretPassword pwd1234

After adding a new secret you can use the secret in .actor/actor.json.

{
    "actorSpecification": 1,
    "name": "dataset-to-mysql",
    ...
    "environmentVariables": {
      "MYSQL_PASSWORD": "@mySecretPassword"
    },
    ...
}

Need help?

To see all CLI commands simply run:

apify help

To get information about a specific command run:

apify help COMMAND

Still haven't found what you were looking for? Please go to Apify Help center or contact us.

Command reference

This section contains printouts of apify help for all commands.

apify actor

Commands are designed to be used in Actor runs. All commands are in PoC state, do not use in production environments.

USAGE
  $ apify actor

DESCRIPTION
  Commands are designed to be used in Actor runs. All commands are in PoC state, do not use in production environments.

See code: src/commands/actor/index.ts

apify actor:get-input

Gets the Actor input value from the default key-value store associated with the Actor run.

USAGE
  $ apify actor:get-input

DESCRIPTION
  Gets the Actor input value from the default key-value store associated with the Actor run.

See code: src/commands/actor/get-input.ts

apify actor:get-value KEY

Gets a value from the default key-value store associated with the Actor run.

USAGE
  $ apify actor:get-value KEY

ARGUMENTS
  KEY  Key of the record in key-value store

DESCRIPTION
  Gets a value from the default key-value store associated with the Actor run.

See code: src/commands/actor/get-value.ts

apify actor:push-data [ITEM]

Stores an object or an array of objects to the default dataset of the Actor run.

USAGE
  $ apify actor:push-data [ITEM]

ARGUMENTS
  ITEM  JSON string with one object or array of objects containing data to be stored in the default dataset.

DESCRIPTION
  Stores an object or an array of objects to the default dataset of the Actor run.
  It is possible to pass data using item argument or stdin.
  Passing data using argument:
  $ apify actor:push-data {"foo": "bar"}
  Passing data using stdin with pipe:
  $ cat ./test.json | apify actor:push-data

See code: src/commands/actor/push-data.ts

apify actor:set-value KEY [VALUE]

Sets or removes record into the default KeyValueStore associated with the Actor run.

USAGE
  $ apify actor:set-value KEY [VALUE] [-c <value>]

ARGUMENTS
  KEY    Key of the record in key-value store.
  VALUE  Record data, which can be one of the following values:
         - If empty, the record in the key-value store is deleted.
         - If no `contentType` flag is specified, value is expected to be any JSON string value.
         - If options.contentType is set, value is taken as is.

FLAGS
  -c, --contentType=<value>  Specifies a custom MIME content type of the record. By default "application/json" is used.

DESCRIPTION
  Sets or removes record into the default KeyValueStore associated with the Actor run.
  It is possible to pass data using argument or stdin.
  Passing data using argument:
  $ apify actor:set-value KEY my-value
  Passing data using stdin with pipe:
  $ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain

See code: src/commands/actor/set-value.ts

apify call [ACTORID]

Runs a specific Actor remotely on the Apify cloud platform.

USAGE
  $ apify call [ACTORID] [-b <value>] [-t <value>] [-m <value>] [-w <value>]

ARGUMENTS
  ACTORID  Name or ID of the Actor to run (e.g. "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). If not provided, the
           command runs the remote actor specified in the ".actor/actor.json" file.

FLAGS
  -b, --build=<value>            Tag or number of the build to run (e.g. "latest" or "1.2.34").
  -m, --memory=<value>           Amount of memory allocated for the Actor run, in megabytes.
  -t, --timeout=<value>          Timeout for the Actor run in seconds. Zero value means there is no timeout.
  -w, --wait-for-finish=<value>  Seconds for waiting to run to finish, if no value passed, it waits forever.

DESCRIPTION
  Runs a specific Actor remotely on the Apify cloud platform.
  The Actor is run under your current Apify account. Therefore you need to be logged in by calling "apify login". It
  takes input for the Actor from the default local key-value store by default.

See code: src/commands/call.ts

apify create [ACTORNAME]

Creates a new actor project directory from a selected boilerplate template.

USAGE
  $ apify create [ACTORNAME] [-t <value>] [--skip-dependency-install]

ARGUMENTS
  ACTORNAME  Name of the Actor and its directory

FLAGS
  -t, --template=<value>         Template for the Actor. If not provided, the command will prompt for it.
                                 Visit
                                 https://raw.githubusercontent.com/apify/actor-templates/master/templates/manifest.json
                                 to find available template names.
      --skip-dependency-install  Skip installing Actor dependencies.

DESCRIPTION
  Creates a new actor project directory from a selected boilerplate template.

See code: src/commands/create.ts

apify help [COMMANDS]

Display help for apify.

USAGE
  $ apify help [COMMANDS] [-n]

ARGUMENTS
  COMMANDS  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for apify.

See code: @oclif/plugin-help

apify info

Displays information about the currently active Apify account.

USAGE
  $ apify info

DESCRIPTION
  Displays information about the currently active Apify account.
  The information is printed to the console.

See code: src/commands/info.ts

apify init [ACTORNAME]

Initializes a new Actor project in an existing directory.

USAGE
  $ apify init [ACTORNAME] [-y]

ARGUMENTS
  ACTORNAME  Name of the Actor. If not provided, you will be prompted for it.

FLAGS
  -y, --yes  Automatic yes to prompts; assume "yes" as answer to all prompts. Note that in some cases, the command may
             still ask for confirmation.

DESCRIPTION
  Initializes a new Actor project in an existing directory.
  If the directory contains a Scrapy project in Python, the command automatically creates wrappers so that you can run
  your scrapers without changes.

  The command creates the ".actor/actor.json" file and the "storage" directory in the current directory, but does not
  touch any other existing files or directories.

  WARNING: The directory at "storage" will be overwritten if it already exists.

See code: src/commands/init.ts

apify login

Logs in to your Apify account using a provided API token.

USAGE
  $ apify login [-t <value>]

FLAGS
  -t, --token=<value>  [Optional] Apify API token

DESCRIPTION
  Logs in to your Apify account using a provided API token.
  The API token and other account information is stored in the ~/.apify directory, from where it is read by all other
  "apify" commands. To log out, call "apify logout".

See code: src/commands/login.ts

apify logout

Logs out of your Apify account.

USAGE
  $ apify logout

DESCRIPTION
  Logs out of your Apify account.
  The command deletes the API token and all other account information stored in the ~/.apify directory. To log in again,
  call "apify login".

See code: src/commands/logout.ts

apify pull [ACTORID]

Pulls an Actor from the Apify platform to the current directory. If it is defined as Git repository, it will be cloned. If it is defined as Web IDE, it will fetch the files.

USAGE
  $ apify pull [ACTORID] [-v <value>]

ARGUMENTS
  ACTORID  Name or ID of the Actor to run (e.g. "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). If not provided, the
           command will update the Actor in the current directory based on its name in ".actor/actor.json" file.

FLAGS
  -v, --version=<value>  Actor version number which will be pulled, e.g. 1.2. Default: the highest version

DESCRIPTION
  Pulls an Actor from the Apify platform to the current directory. If it is defined as Git repository, it will be
  cloned. If it is defined as Web IDE, it will fetch the files.

See code: src/commands/pull.ts

apify push [ACTORID]

Uploads the Actor to the Apify platform and builds it there.

USAGE
  $ apify push [ACTORID] [--version-number <value>] [-v <value>] [-b <value>] [-w <value>] [--no-prompt]

ARGUMENTS
  ACTORID  Name or ID of the Actor to push (e.g. "apify/hello-world" or "E2jjCZBezvAZnX8Rb"). If not provided, the
           command will create or modify the Actor with the name specified in ".actor/actor.json" file.

FLAGS
  -b, --build-tag=<value>        Build tag to be applied to the successful Actor build. By default, it is taken from the
                                 ".actor/actor.json" file
  -v, --version=<value>          Actor version number to which the files should be pushed. By default, it is taken from
                                 the ".actor/actor.json" file.
  -w, --wait-for-finish=<value>  Seconds for waiting to build to finish, if no value passed, it waits forever.
      --no-prompt                Do not prompt for opening the Actor details in a browser. This will also not open the
                                 browser automatically.
      --version-number=<value>   DEPRECATED: Use flag version instead. Actor version number to which the files should be
                                 pushed. By default, it is taken from the ".actor/actor.json" file.

DESCRIPTION
  Uploads the Actor to the Apify platform and builds it there.
  The Actor settings are read from the ".actor/actor.json" file in the current directory, but they can be overridden
  using command-line options.
  NOTE: If the source files are smaller than 3 MB then they are uploaded as
  "Multiple source files", otherwise they are uploaded as "Zip file".

  WARNING: If the target Actor already exists in your Apify account, it will be overwritten!

See code: src/commands/push.ts

apify run

Runs the Actor locally in the current directory.

USAGE
  $ apify run [-p] [--purge-queue] [--purge-dataset] [--purge-key-value-store]

FLAGS
  -p, --purge                  Shortcut that combines the --purge-queue, --purge-dataset and --purge-key-value-store
                               options.
      --purge-dataset          Deletes the local directory containing the default dataset before the run starts.
      --purge-key-value-store  Deletes all records from the default key-value store in the local directory before the
                               run starts, except for the "INPUT" key.
      --purge-queue            Deletes the local directory containing the default request queue before the run starts.

DESCRIPTION
  Runs the Actor locally in the current directory.
  It sets various APIFY_XYZ environment variables in order to provide a working execution environment for the Actor. For
  example, this causes the Actor input, as well as all other data in key-value stores, datasets or request queues to be
  stored in the "storage" directory, rather than on the Apify platform.

  NOTE: You can override the command's default behavior for Node.js actors by overriding the "start" script in the
  package.json file. You can set up your own main file or environment variables by changing it.

See code: src/commands/run.ts

apify secrets

Manages secret values for Actor environment variables.

USAGE
  $ apify secrets

DESCRIPTION
  Manages secret values for Actor environment variables.

  Example:
  $ apify secrets:add mySecret TopSecretValue123

  Now the "mySecret" value can be used in an environment variable defined in ".actor/actor.json" file by adding the "@"
  prefix:

  {
  "actorSpecification": 1,
  "name": "my_actor",
  "environmentVariables": { "SECRET_ENV_VAR": "@mySecret" },
  "version": "0.1
  }

  When the Actor is pushed to Apify cloud, the "SECRET_ENV_VAR" and its value is stored as a secret environment variable
  of the Actor.

See code: src/commands/secrets/index.ts

apify secrets:add NAME VALUE

Adds a new secret value.

USAGE
  $ apify secrets:add NAME VALUE

ARGUMENTS
  NAME   Name of the secret
  VALUE  Value of the secret

DESCRIPTION
  Adds a new secret value.
  The secrets are stored to a file at ~/.apify

See code: src/commands/secrets/add.ts

apify secrets:rm NAME

Removes the secret.

USAGE
  $ apify secrets:rm NAME

ARGUMENTS
  NAME  Name of the secret

DESCRIPTION
  Removes the secret.

See code: src/commands/secrets/rm.ts

apify vis [PATH]

Validates input schema and prints errors found.

USAGE
  $ apify vis [PATH]

ARGUMENTS
  PATH  Optional path to your INPUT_SCHEMA.json file. If not provided ./INPUT_SCHEMA.json is used.

DESCRIPTION
  Validates input schema and prints errors found.
  The input schema for the Actor is used from these locations in order of preference.
  The first one found is validated as it would be the one used on the Apify platform.
  1. Directly embedded object in ".actor/actor.json" under 'input' key
  2. Path to JSON file referenced in ".actor/actor.json" under 'input' key
  3. JSON file at .actor/INPUT_SCHEMA.json
  4. JSON file at INPUT_SCHEMA.json

  You can also pass any custom path to your input schema to have it validated instead.

See code: src/commands/vis.ts

apify-cli's People

Contributors

andreybykov avatar b4nan avatar barjin avatar davidjohnbarton avatar dependabot[bot] avatar drobnikj avatar fisknils avatar fnesveda avatar gippy avatar honzajavorek avatar honzaturon avatar jancurn avatar jirimoravcik avatar m-murasovs avatar metalwarrior665 avatar mhamas avatar mnmkng avatar monkey-denky avatar mtrunkat avatar mvolfik avatar novotnyj avatar oliketen avatar petrpatek avatar renovate[bot] avatar tc-mo avatar tobice avatar valekjo avatar vdusek avatar vladfrangu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apify-cli's Issues

Don't hard code main.js, use main file from package.json

When you run apify init in a normal Node.js project with other main file than 'main.js', it succeeds, but then when you run apify run you get this error:

Error: The "main.js" file not found in the current directory. Call "apify init" to create it.

We shouldn't hard-code "main.js" anywhere, user can use any file. Just read it from package.json

Apify pull ${actId}

It would be lovely to be able to login to the account and call Apify pull actId/actName and it would download the code to the folder where I am.

Apify call - name

If I call my own Act, not to have to put my name before name of the act, so my call could be just

apify call name-of-act

and not

apify call myusername/name-of-act

But this is a minor issue.

Add 'blank' template to 'apify-create'

When I want to start developing non-javascript Actor locally, I certainly don't need to any node_modules (or do I?) and possibly even apify_local storage.

It would be nice to have such a blank template that would still have the functionality like Apify push, apify run etc.

push also BODY(INPUT.json) from local

It will be great if there will be possible by the command "apify push" to push also INPUT.json to Actor. There could be added a parameter to force it.

By default act continues in requestQueue if the queue is not deleted manually

When I run the act once, it creates a requestQueue, it fails on something, so I update the code and run it once more but it continues in the queue and might crash because of the updates.

I would suggest adding some param for Apify run, maybe something like apify run -c / -clean that would delete the folder of request-queues before the run, because it is also good to have the possibility to continue in the queue.

Validation for length of a name of actor

I am able to do this

apify create superlongdescriptiontotesthtelengthofthename

but at apify push I get error that the name can be max 30 chars, would be nice have the error at create.

Issues with login

Hi

I just run the command apify login and here is the output of the command:

Error: Logging into Apify failed, token or userId is not correct.
Success: Logged into Apify!

In the end I'm apparently not logged. I dont think it's an issue with wrong credentials, tought, I can try again.

Here is the results when I run the command apify push:

Error: You aren't logged call "apify login" to process login.
Info: Push act-name to Apify.
Run: Zipping all act files ...
Error: Cannot read property 'keyValueStores' of undefined

apify call with input data

Would it be possible to add option to pass an input data to the actor? i.e.:
apify call xxx --input-file=~/input.json

Display install bar when using 'apify create'

Sometimes it takes ages to install all the packages to create a new folder. It could be confusing for new users to watch their console sitting and doing nothing. Maybe at least display something like 'installing, please wait' or 'loading'.

"apify info" prints out token and proxy password

IMHO apify info shouldn't print out secrets like API token and proxy password. For example, when user is entering token in apify login, it's hidded, while here it's not. That's not consistent behavior and it's a potential security issue. Let's just skip these fields altogether.

Add INPUT schema checks to "apify run"

If actor has an INPUT schema, then "apify run" should validate the input against the schema, using the exactly same code as Apify cloud is doing that.

Show a note when the actor reuses old state from apify_storage

We should add some warning message to Apify CLI saying that “The apify_storage directory contains a previous state, the actor will continue where it left off. To start from the initial state, use —purge parameter to clean the apify_storage directory”. Only show this if there are some files except for INPUT.json.

The point is to make sure users are not surprised when the crawler immediately finishes when they restart the actor using "apify run".

files attribute must be specified

Hey, I just installed apify-cli using npm -g i apify-cli
I'm running Windows 7 64bit

node -v v9.5.0
npm -v 6.0.0

Whenever I run apify, I get the following error messsage:

(node:9672) Error Plugin: apify-cli: files attribute must be specified in C:\Users\fisknils\AppData\Roaming\npm\node_modules\apify-cli\package.json

I figured it might not be optimized for windows, so I also tried it on a linux box running

node -v v10.1.0
npm -v 6.1.0

But I get the (basically) the same error.

I also tried downgrading, through nvm, to the same version as someone from your support staff, v9.3.0, but sadly, this didn't solve my problems either.

fisknils@linuxburk11:~$ apify
(node:28307) Error Plugin: apify-cli: files attribute must be specified in 
/home/fisknils/.nvm/versions/node/v9.3.0/lib/node_modules/apify-cli/package.json
module: @oclif/[email protected]
plugin: apify-cli
root: /home/fisknils/.nvm/versions/node/v9.3.0/lib/node_modules/apify-cli
See more details with DEBUG=*
Apify command line client to help you create, develop, build and run Actor acts.

VERSION
  apify-cli/0.1.9 linux-x64 node-v9.3.0

USAGE
  $ apify [COMMAND]

COMMANDS
  call    Runs the act remotely on the Apify platform.
  create  Creates a new act project directory from a selected template.
  info    Displays information about current Apify settings.
  init    Initializes an act project in an existing directory.
  login   Logs in to the Apify platform using the API token.
  logout  Logs out of the Apify platform.
  push    Uploads the act to the Apify platform and builds it there.
  run     Runs the act locally in the current directory.

I tried googling, but couldn't find any references to this problem.

I'm attaching log files from running with DEBUG=*
linux-debuglog.txt
win-debuglog.txt

Also, this is the output from tree on the linux box after running apify init in an empty directory
tree.txt

The tree structure on the windows machine looks the same.

Add support to override env from apify.json

Users want to override to env attribute in apify.json for local actors runs.

  • add support for file apify.local.json, where user can override env for local runs
  • decribe it into readme

Stream logs from build and run

http.get('http://api.apify.com/v2/logs/[LOG_ID]?stream=1')
.on('response', (response) => {
    response.on('data', function (chunk) {
        console.log(chunk.toString());
    });
    response.on('end', function () {
        console.log('Finished');
    });
});

Stream gets finished when run/build gets finished/failed so you don't need to request the state.

Login sometimes doesn't work - Windows

This happened to me a few months ago and now to one user:

Executing "apify login" and then inputing token doesn't work.
"apify -t ***" doesn't work either
"apify -- token ***" works

"apify run" should fail if user is not logged in

Even though I'm not logged in:

$ apify info
Error: You are not logged in with your Apify account. Call "apify login" to fix that.

Running the actor works fine, only to fail later:

$ apify run
Run: npm start

> [email protected] start /Users/jan/Projects/actor-xxx
> node main.js

INFO: Snapshotter: Setting max memory of this run to 4096 MB. Use the APIFY_MEMORY_MBYTES environment variable to override it.
INFO: AutoscaledPool state {"currentConcurrency":0,"desiredConcurrency":2,"systemStatus":{"isSystemIdle":true,"memInfo":{"isOverloaded":false,"maxOverloadedRatio":0.2,"actualRatio":null},"eventLoopInfo":{"isOverloaded":false,"maxOverloadedRatio":0.2,"actualRatio":null},"cpuInfo":{"isOverloaded":false,"maxOverloadedRatio":0.4,"actualRatio":null}}}
ERROR: PuppeteerPool: browser launch failed {"id":0}
  ApifyClientError: Apify Proxy password must be provided as parameter or "APIFY_PROXY_PASSWORD" environment variable!

That's a confusing behavior. apify run should fail fast and tell users what to do, rather then let them figure it out themselves.

Display warning when newer version is available

Every day when user uses Apify CLI for the first time and is online we should check for newer version.

For example the user with CLI from the last week gets an error Error: The ‘APIFY_DEFAULT_REQUEST_QUEUE_ID’ environment variable is not defined.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.