in lib/google/serverless/exec/tasks.rb [342:390]
def start_and_report_errors app_exec
app_exec.start
rescue Exec::ConfigFileNotFound => e
report_error <<~MESSAGE
Could not determine which service should run this command because the App
Engine config file "#{e.config_path}" was not found.
Specify the config file using the EXEC_APP_CONFIG argument. e.g.
bundle exec rake serverless:exec EXEC_APP_CONFIG=myapp.yaml -- myscript.sh
Alternately, specify a service name directly with EXEC_SERVICE_NAME. e.g.
bundle exec rake serverless:exec EXEC_SERVICE_NAME=myservice -- myscript.sh
MESSAGE
rescue Exec::BadConfigFileFormat => e
report_error <<~MESSAGE
Could not determine which service should run this command because the App
Engine config file "#{e.config_path}" was malformed.
It must be a valid YAML file.
Specify the config file using the EXEC_APP_CONFIG argument. e.g.
bundle exec rake serverless:exec EXEC_APP_CONFIG=myapp.yaml -- myscript.sh
Alternately, specify a service name directly with EXEC_SERVICE_NAME. e.g.
bundle exec rake serverless:exec EXEC_SERVICE_NAME=myservice -- myscript.sh
MESSAGE
rescue Exec::NoSuchVersion => e
if e.version
report_error <<~MESSAGE
Could not find version "#{e.version}" of service "#{e.service}".
Please double-check the version exists. To use the most recent version by
default, omit the EXEC_APP_VERSION argument.
MESSAGE
else
report_error <<~MESSAGE
Could not find any versions of service "#{e.service}".
Please double-check that you have deployed this service. If you want to run
a command against a different service, you may provide a EXEC_APP_CONFIG
argument pointing to your App Engine config file, or a EXEC_SERVICE_NAME
argument to specify a service directly.
MESSAGE
end
rescue Exec::NoDefaultProject
report_error <<~MESSAGE
Could not get the default project from gcloud.
Please either set the current project using
gcloud config set project my-project-id
or specify the project by setting the EXEC_PROJECT argument. e.g.
bundle exec rake serverless:exec EXEC_PROJECT=my-project-id -- myscript.sh
MESSAGE
rescue Exec::UsageError => e
report_error e.message
end