Skip to content

NoMethodError: undefined method `credentials' for nil:NilClass #1857

@allcentury

Description

@allcentury

Issue description

We're seeing transient issues when trying to generate a presigned url for an S3 object, via:

 s3_object.presigned_url(:get, expires_in: 10.minutes)

The stacktrace:

NoMethodError: undefined method `credentials' for nil:NilClass
  from aws-sdk-core/signers/v4.rb:45:in `initialize'
  from aws-sdk-core/s3/presigner.rb:101:in `new'
  from aws-sdk-core/s3/presigner.rb:101:in `block in sign_but_dont_send'
  from aws-sdk-core/plugins/s3_request_signer.rb:88:in `call'
  from aws-sdk-core/xml/error_handler.rb:8:in `call'
  from aws-sdk-core/plugins/helpful_socket_errors.rb:10:in `call'
  from aws-sdk-core/plugins/s3_request_signer.rb:65:in `call'
  from aws-sdk-core/plugins/s3_redirects.rb:15:in `call'
  from aws-sdk-core/plugins/retry_errors.rb:88:in `call'
  from aws-sdk-core/plugins/s3_dualstack.rb:32:in `call'
  from aws-sdk-core/plugins/s3_accelerate.rb:49:in `call'
  from aws-sdk-core/plugins/s3_md5s.rb:31:in `call'
  from aws-sdk-core/plugins/s3_expect_100_continue.rb:21:in `call'
  from aws-sdk-core/plugins/s3_bucket_name_restrictions.rb:12:in `call'
  from aws-sdk-core/plugins/s3_bucket_dns.rb:31:in `call'
  from aws-sdk-core/rest/handler.rb:7:in `call'
  from aws-sdk-core/plugins/user_agent.rb:12:in `call'
  from seahorse/client/plugins/endpoint.rb:41:in `call'
  from aws-sdk-core/plugins/param_validator.rb:21:in `call'
  from seahorse/client/plugins/raise_response_errors.rb:14:in `call'
  from aws-sdk-core/plugins/s3_sse_cpk.rb:19:in `call'
  from aws-sdk-core/plugins/s3_dualstack.rb:24:in `call'
  from aws-sdk-core/plugins/s3_accelerate.rb:34:in `call'
  from aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
  from aws-sdk-core/plugins/idempotency_token.rb:18:in `call'
  from aws-sdk-core/plugins/param_converter.rb:20:in `call'
  from seahorse/client/plugins/response_target.rb:21:in `call'
  from seahorse/client/request.rb:70:in `send_request'
  from aws-sdk-core/s3/presigner.rb:54:in `presigned_url'
  from aws-sdk-resources/services/s3/object.rb:189:in `presigned_url'

Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version

aws-sdk 2.9.14,

Version of Ruby, OS environment

ruby 2.2.3 / alpine 3.4 docker(https://github.com/gliderlabs/docker-alpine/blob/236558862619cbc7b7429c528d941b57692d85f3/versions/library-3.4/Dockerfile)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions