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

NoCredentialsError if no credentials defined #1924

Closed
t-chaik opened this issue Nov 5, 2018 · 3 comments
Closed

NoCredentialsError if no credentials defined #1924

t-chaik opened this issue Nov 5, 2018 · 3 comments

Comments

@t-chaik
Copy link

t-chaik commented Nov 5, 2018

Testing 1.3.7 and the fix for #1793:

boto                     2.49.0
boto3                    1.9.37
botocore                 1.12.37
moto                     1.3.7

Trying to run the context manager example:

Python 3.6.7 (default, Oct 21 2018, 08:08:16) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
>>> from moto import mock_s3
>>> with mock_s3():
...     conn = boto3.resource('s3', region_name='us-east-1')
...     conn.create_bucket(Bucket='mybucket')
... 

Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/boto3/resources/factory.py", line 520, in do_action
    response = action(self, *args, **kwargs)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/boto3/resources/action.py", line 83, in __call__
    response = getattr(parent.meta.client, operation_name)(**params)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/client.py", line 320, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/client.py", line 610, in _make_api_call
    operation_model, request_dict)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/endpoint.py", line 132, in _send_request
    request = self.create_request(request_dict, operation_model)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/endpoint.py", line 116, in create_request
    operation_name=operation_model.name)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/signers.py", line 90, in handler
    return self.sign(operation_name, request)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/signers.py", line 157, in sign
    auth.add_auth(request)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/auth.py", line 425, in add_auth
    super(S3SigV4Auth, self).add_auth(request)
  File "/home/martinblanchard/Work/env/buildgrid/lib/python3.6/site-packages/botocore/auth.py", line 357, in add_auth
    raise NoCredentialsError
botocore.exceptions.NoCredentialsError: Unable to locate credentials

Setting AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID (to whatever) seems to fix the issue. Not sure if mocking without providing any credential is something actually supported by moto, but it used to work with moto<1.3.7, boto3<1.8.0 and botocore<1.11.0.

@t-chaik t-chaik changed the title NoCredentialsError if no ACCESS defined NoCredentialsError if no credentials defined Nov 5, 2018
mattsb42-aws added a commit to aws/aws-dynamodb-encryption-python that referenced this issue Nov 5, 2018
phobologic added a commit to cloudtools/stacker that referenced this issue Dec 3, 2018
phobologic added a commit to cloudtools/stacker that referenced this issue Dec 3, 2018
* Pinning PyYAML to 3.13 to deal with cfn-flip pin

awslabs/aws-cfn-template-flip#54

YAML was pinned in the cfn-flip package that troposphere depends on, and
without this we have issues with building.

* yay, they removed the pinning!

awslabs/aws-cfn-template-flip#58

* Ugh, have to go back to pinning moto.

getmoto/moto#1924
getmoto/moto#1941
phrohdoh pushed a commit to phrohdoh/stacker that referenced this issue Dec 18, 2018
* Pinning PyYAML to 3.13 to deal with cfn-flip pin

awslabs/aws-cfn-template-flip#54

YAML was pinned in the cfn-flip package that troposphere depends on, and
without this we have issues with building.

* yay, they removed the pinning!

awslabs/aws-cfn-template-flip#58

* Ugh, have to go back to pinning moto.

getmoto/moto#1924
getmoto/moto#1941
@spulec
Copy link
Collaborator

spulec commented Dec 29, 2018

Closed with #1952

@spulec spulec closed this as completed Dec 29, 2018
@t-chaik
Copy link
Author

t-chaik commented Feb 19, 2019

@spulec: Thanks for the fix! Any idea when a new release will be cut? Would be nice to have that fix released in a stable version.

@yan12125
Copy link
Contributor

Here's a concern that the fix added in #1952 breaks some other use cases: #2058

devenney added a commit to devenney/sceptre that referenced this issue Mar 3, 2019
* Works around getmoto/moto#1924 by ensuring
garbage defaults are set in the environment.

Signed-off-by: Brendan Devenney <[email protected]>
devenney pushed a commit to devenney/sceptre that referenced this issue Mar 6, 2019
* Works around getmoto/moto#1924 by ensuring garbage defaults are set in the environment.

Signed-off-by: Brendan Devenney <[email protected]>
aodj added a commit to multiplechoice/spiders that referenced this issue Apr 9, 2019
ngfgrant pushed a commit to Sceptre/sceptre that referenced this issue Jun 13, 2019
* Works around getmoto/moto#1924 by ensuring garbage defaults are set in the environment.

Signed-off-by: Brendan Devenney <[email protected]>
ngfgrant pushed a commit to Sceptre/sceptre that referenced this issue Jun 13, 2019
* Works around getmoto/moto#1924 by ensuring garbage defaults are set in the environment.

Signed-off-by: Brendan Devenney <[email protected]>
ngfgrant pushed a commit to Sceptre/sceptre that referenced this issue Jun 13, 2019
Note that this commit suppressed DeprecationWarnings due to dependencies
which have not yet updated their use of collections.abc.

Add pyenv to CI: support multiple Python versions

* Bump CI Docker image version (to 0.4)
* Add pyenv to Docker image
* Support py27, py36, py37

Fix CI interaction with moto 1.3.7. Works around getmoto/moto#1924 by
ensuring garbage defaults are set in the environment.

Update setup.py for Python3.7 support

Add package requirements for testing on python3.7/win
ngfgrant pushed a commit to Sceptre/sceptre that referenced this issue Jun 13, 2019
Note that this commit suppressed DeprecationWarnings due to dependencies
which have not yet updated their use of collections.abc.

Add pyenv to CI: support multiple Python versions

* Bump CI Docker image version (to 0.4)
* Add pyenv to Docker image
* Support py27, py36, py37

Fix CI interaction with moto 1.3.7. Works around getmoto/moto#1924 by
ensuring garbage defaults are set in the environment.

Update setup.py for Python3.7 support

Add package requirements for testing on python3.7/win
ngfgrant pushed a commit to Sceptre/sceptre that referenced this issue Jun 13, 2019
Note that this commit suppressed DeprecationWarnings due to dependencies
which have not yet updated their use of collections.abc.

Add pyenv to CI: support multiple Python versions

* Bump CI Docker image version (to 0.4)
* Add pyenv to Docker image
* Support py27, py36, py37

Fix CI interaction with moto 1.3.7. Works around getmoto/moto#1924 by
ensuring garbage defaults are set in the environment.

Update setup.py for Python3.7 support

Add package requirements for testing on python3.7/win
ngfgrant pushed a commit to Sceptre/sceptre that referenced this issue Jun 13, 2019
Note that this commit suppressed DeprecationWarnings due to dependencies
which have not yet updated their use of collections.abc.

Add pyenv to CI: support multiple Python versions

* Bump CI Docker image version (to 0.4)
* Add pyenv to Docker image
* Support py27, py36, py37

Fix CI interaction with moto 1.3.7. Works around getmoto/moto#1924 by
ensuring garbage defaults are set in the environment.

Update setup.py for Python3.7 support

Add package requirements for testing on python3.7/win
ngfgrant pushed a commit to Sceptre/sceptre that referenced this issue Jun 13, 2019
Note that this commit suppressed DeprecationWarnings due to dependencies
which have not yet updated their use of collections.abc.

Add pyenv to CI: support multiple Python versions

* Bump CI Docker image version (to 0.4)
* Add pyenv to Docker image
* Support py27, py36, py37

Fix CI interaction with moto 1.3.7. Works around getmoto/moto#1924 by
ensuring garbage defaults are set in the environment.

Update setup.py for Python3.7 support

Add package requirements for testing on python3.7/win
ngfgrant pushed a commit to Sceptre/sceptre that referenced this issue Jun 26, 2019
Note that this commit suppressed DeprecationWarnings due to dependencies
which have not yet updated their use of collections.abc.

Add pyenv to CI: support multiple Python versions

* Bump CI Docker image version (to 0.4)
* Add pyenv to Docker image
* Support py27, py36, py37

Fix CI interaction with moto 1.3.7. Works around getmoto/moto#1924 by
ensuring garbage defaults are set in the environment.

Update setup.py for Python3.7 support

Add package requirements for testing on python3.7/win
thawkson pushed a commit to thawkson/sceptre that referenced this issue Feb 6, 2021
Note that this commit suppressed DeprecationWarnings due to dependencies
which have not yet updated their use of collections.abc.

Add pyenv to CI: support multiple Python versions

* Bump CI Docker image version (to 0.4)
* Add pyenv to Docker image
* Support py27, py36, py37

Fix CI interaction with moto 1.3.7. Works around getmoto/moto#1924 by
ensuring garbage defaults are set in the environment.

Update setup.py for Python3.7 support

Add package requirements for testing on python3.7/win
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants