lib/plugins/aws/invoke/index.js/AwsInvoke/extendedValidate
class AwsInvoke:  extendedValidate() {
    return this.validate().then(() => {
      // validate function exists in service
      this.options.functionObj = this.serverless.service.getFunction(this.options.function);
      this.options.data = this.options.data || '';

      return new BbPromise(resolve => {
        if (this.options.data) {
          return resolve();
        } else if (this.options.path) {
          const absolutePath = path.isAbsolute(this.options.path)
            ? this.options.path
            : path.join(this.serverless.config.servicePath, this.options.path);
          if (!this.serverless.utils.fileExistsSync(absolutePath)) {
            throw new this.serverless.classes.Error('The file you provided does not exist.');
          }
          this.options.data = this.serverless.utils.readFileSync(absolutePath);
          return resolve();
        }

        return stdin()
          .then(input => {
            this.options.data = input;
            return resolve();
          })
          .catch(() => resolve());
      }).then(() => {
        try {
          if (!this.options.raw) {
            this.options.data = JSON.parse(this.options.data);
          }
        } catch (exception) {
          // do nothing if it's a simple string or object already
        }
      });
    });
  }