title: AWS SDK not including Access Key (AKID) in X-Amz-Credential when creating presigned post, but only on Heroku
body: <p>I am doing a direct to S3 upload, and I have the presigned post declared like this:</p>
  
  <pre><code>@s3_direct_post = S3_BUCKET.presigned_post(key: "images/#{SecureRandom.uuid}/${filename}", success_action_status: '201', acl: 'public-read', allow_any: ['utf8', 'authenticity_token'])
  </code></pre>
  
  <p>When in the development environment, it builds everything correctly and I get something like this:</p>
  
  <pre><code>{"key"=&gt;"images/1be59d13-9d65-4d70-b631-93834409f361/${filename}", "success_action_status"=&gt;"201", "acl"=&gt;"public-read", "policy"=&gt;"&lt;BASE_64_POLICY&gt;", "x-amz-credential"=&gt;"&lt;MY_ACCESS_KEY&gt;/20180505/us-east-1/s3/aws4_request", "x-amz-algorithm"=&gt;"AWS4-HMAC-SHA256", "x-amz-date"=&gt;"20180505T232823Z", "x-amz-signature"=&gt;"&lt;AMZ_SIGNATURE&gt;"}
  </code></pre>
  
  <p>But after I push it to Heroku, I get something like this:</p>
  
  <pre><code>{"key"=&gt;"images/1be59d13-9d65-4d70-b631-93834409f361/${filename}", "success_action_status"=&gt;"201", "acl"=&gt;"public-read", "policy"=&gt;"&lt;BASE_64_POLICY&gt;", "x-amz-credential"=&gt;"/20180505/us-east-1/s3/aws4_request", "x-amz-algorithm"=&gt;"AWS4-HMAC-SHA256", "x-amz-date"=&gt;"20180505T232823Z", "x-amz-signature"=&gt;"&lt;AMZ_SIGNATURE&gt;"}
  </code></pre>
  
  <p>Now that my Access Key (AKID) is no longer there, I get this error:</p>
  
  <pre><code>&lt;Error&gt;&lt;Code&gt;InvalidArgument&lt;/Code&gt;&lt;Message&gt;a non-empty Access Key (AKID) must be provided in the credential.&lt;/Message&gt;&lt;ArgumentName&gt;X-Amz-Credential&lt;/ArgumentName&gt;&lt;ArgumentValue&gt;/20180505/us-east-1/s3/aws4_request&lt;/ArgumentValue&gt;&lt;RequestId&gt;%REQUESTID%&lt;/RequestId&gt;&lt;HostId&gt;%HOSTID%&lt;/HostId&gt;&lt;/Error&gt;
  </code></pre>
  
  <p>My AWS credentials are declared in initalizers/aws.rb, so they are not dependent on the environment type. What could possibly be causing this?</p>
  
  <p>Edit (showing how I declare the S3_BUCKET is a constant I initialize in aws.rb):</p>
  
  <p><code>Aws.config.update({
    region: 'us-east-1',
    credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
  })</code></p>
  
  <p><code>S3_BUCKET = Aws::S3::Resource.new.bucket(ENV['S3_BUCKET'])</code></p>
  
  <p>Also, the difference between the two presigned-post objects:</p>
  
  <p><code>"x-amz-credential"=&gt;"&lt;MY_ACCESS_KEY&gt;/20180505/us-east-1/s3/aws4_request"</code></p>
  
  <p><code>"x-amz-credential"=&gt;"/20180505/us-east-1/s3/aws4_request"</code></p>