I have created a new S3 bucket on aws. I have a certificate issue I didn't have with the same code on my original bucket.
我在aws上创建了一个新的S3存储桶。我有一个证书问题,我没有在原始存储桶上使用相同的代码。
Here is the code :
这是代码:
AWS.config(access_key_id: AWS_ACCESS_KEY_ID, secret_access_key:AWS_SECRET_ACCESS_KEY, region: S3_REGION)
s3 = AWS::S3.new
bucket = s3.buckets[S3_BUCKET_NAME]
@resp = bucket.objects.with_prefix('categories/'+@category.id.to_s+"/")
@resp.each do |item|
end
returns the following error when "@resp.each" is executed:
执行“@ resp.each”时返回以下错误:
hostname does not match the server certificate (OpenSSL::SSL::SSLError)
- ENV variables were updated with new region and new bucket name
- Uploading images is working
- @resp is returning AWS::S3::ObjectCollection:0x007f815e099d18
- my bucket name doesn't contain dots
ENV变量使用新区域和新存储桶名称进行更新
正在上传图片
@resp返回AWS :: S3 :: ObjectCollection:0x007f815e099d18
我的桶名称不包含点
Is there something to configurate on AWS S3 to avoid this error?
是否可以在AWS S3上配置以避免此错误?
1 个解决方案
#1
0
I was having the same issue, and I solved it by doing:
我遇到了同样的问题,我通过以下方式解决了这个问题:
Aws::S3::Client.new(
:access_key_id => 'YOUR_ACCESS_KEY_ID',
:secret_access_key => 'YOUR_SECRET_ACCESS_KEY',
:region => 'YOUR_REGION',
:force_path_style => true)
Basically, by specifying also a path style. Let me know if it works!
基本上,通过指定路径样式。如果有效,请告诉我!
#1
0
I was having the same issue, and I solved it by doing:
我遇到了同样的问题,我通过以下方式解决了这个问题:
Aws::S3::Client.new(
:access_key_id => 'YOUR_ACCESS_KEY_ID',
:secret_access_key => 'YOUR_SECRET_ACCESS_KEY',
:region => 'YOUR_REGION',
:force_path_style => true)
Basically, by specifying also a path style. Let me know if it works!
基本上,通过指定路径样式。如果有效,请告诉我!