Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better handle when no aws account could be resolved #39

Open
vincentclaes opened this issue Feb 25, 2021 · 2 comments
Open

better handle when no aws account could be resolved #39

vincentclaes opened this issue Feb 25, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@vincentclaes
Copy link
Owner

check this in advance and raise an error from within datajob

Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment
Traceback (most recent call last):
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/bin/datajob", line 8, in <module>
    sys.exit(run())
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/datajob/datajob.py", line 17, in run
    app()
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/typer/main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/datajob/datajob.py", line 37, in deploy
    call_cdk(command="deploy", args=args, extra_args=extra_args)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/zippo-data-layer-_EDEGVNn-py3.6/lib/python3.6/site-packages/datajob/datajob.py", line 73, in call_cdk
    subprocess.check_call(shlex.split(full_command))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cdk', 'deploy', '--app', 'python /Users/vincent/Workspace/zippo-data-layer/deployment_zippo.py', '-c', 'stage=stg']' returned non-zero exit status 1.

@vincentclaes vincentclaes added the enhancement New feature or request label Feb 25, 2021
@vincentclaes
Copy link
Owner Author

Traceback (most recent call last):
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/bin/datajob", line 5, in <module>
    run()
  File "/Users/vincent/Workspace/datajob/datajob/datajob.py", line 77, in run
    stepfunctions_run.run(state_machine=state_machine)
  File "/Users/vincent/Workspace/datajob/datajob/stepfunctions/stepfunctions_run.py", line 27, in run
    state_machine_arn = _find_state_machine_arn(state_machine)
  File "/Users/vincent/Workspace/datajob/datajob/stepfunctions/stepfunctions_run.py", line 8, in _find_state_machine_arn
    workflows = Workflow.list_workflows()
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/stepfunctions/workflow/stepfunctions.py", line 109, in list_workflows
    for page in response_iterator:
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/paginate.py", line 255, in __iter__
    response = self._make_request(current_kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/paginate.py", line 332, in _make_request
    return self._method(**current_kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/client.py", line 663, in _make_api_call
    operation_model, request_dict, request_context)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/client.py", line 682, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/endpoint.py", line 132, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/endpoint.py", line 116, in create_request
    operation_name=operation_model.name)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/signers.py", line 90, in handler
    return self.sign(operation_name, request)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/signers.py", line 162, in sign
    auth.add_auth(request)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/auth.py", line 357, in add_auth
    raise NoCredentialsError
botocore.exceptions.NoCredentialsError: Unable to locate credentials
(datajob-KxqvMF6C-py3.6) Vincents-MacBook-Pro:datajob vincent$ datajob
Usage: datajob [OPTIONS] COMMAND [ARGS]...

Options:
  --install-completion  Install completion for the current shell.
  --show-completion     Show completion for the current shell, to copy it or
                        customize the installation.

  --help                Show this message and exit.

Commands:
  deploy
  destroy
  execute
  synthesize
(datajob-KxqvMF6C-py3.6) Vincents-MacBook-Pro:datajob vincent$ datajob execute
Traceback (most recent call last):
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/bin/datajob", line 5, in <module>
    run()
  File "/Users/vincent/Workspace/datajob/datajob/datajob.py", line 18, in run
    app()
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/typer/main.py", line 497, in wrapper
    return callback(**use_params)  # type: ignore
  File "/Users/vincent/Workspace/datajob/datajob/datajob.py", line 77, in execute
    stepfunctions_execute.execute(state_machine=state_machine)
  File "/Users/vincent/Workspace/datajob/datajob/stepfunctions/stepfunctions_execute.py", line 27, in execute
    state_machine_arn = _find_state_machine_arn(state_machine)
  File "/Users/vincent/Workspace/datajob/datajob/stepfunctions/stepfunctions_execute.py", line 8, in _find_state_machine_arn
    workflows = Workflow.list_workflows()
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/stepfunctions/workflow/stepfunctions.py", line 109, in list_workflows
    for page in response_iterator:
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/paginate.py", line 255, in __iter__
    response = self._make_request(current_kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/paginate.py", line 332, in _make_request
    return self._method(**current_kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/client.py", line 663, in _make_api_call
    operation_model, request_dict, request_context)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/client.py", line 682, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/endpoint.py", line 132, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/endpoint.py", line 116, in create_request
    operation_name=operation_model.name)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/signers.py", line 90, in handler
    return self.sign(operation_name, request)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/signers.py", line 162, in sign
    auth.add_auth(request)
  File "/Users/vincent/Library/Caches/pypoetry/virtualenvs/datajob-KxqvMF6C-py3.6/lib/python3.6/site-packages/botocore/auth.py", line 357, in add_auth
    raise NoCredentialsError
botocore.exceptions.NoCredentialsError: Unable to locate credentials

@vincentclaes
Copy link
Owner Author

we can remediate these exceptions by asking for the necessary info
https://typer.tiangolo.com/tutorial/prompt/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant