Hi there,
I've just installed this module, and tried to use it with Amazon S3.
So I created a bucket, added a new user, and set it up his credentials:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ModifyAssets",
"Action": [
"s3:DeleteObject",
"s3:DeleteObjectVersion",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:GetObjectVersion",
"s3:GetObjectVersionAcl",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:PutObjectVersionAcl"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::mybucketname/*"
]
},
{
"Sid": "BucketRights",
"Action": [
"s3:ListBucket",
"s3:ListAllMyBuckets"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::*"
]
}
]
}

When I try to create a new file storage, I get this error: The bucket name field gets a red border, and that's it. No message, no nothing.
The bucket name is correct, and so ar the user credentials, I've checked them several times.
I've tried with both versions (the stable and the dev). Both it's the same.

Error

UPDATE:

I've thought that maybe the problem could be related with Amazon S3 permission policy. So I've changed it to this, in order to test it out:

This is the default "Power User Access" policy. The result is the same.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "NotAction": "iam:*",
      "Resource": "*"
    }
  ]
}

CommentFileSizeAuthor
error.png63.27 KBRosamunda
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Rosamunda’s picture

Issue summary: View changes
Perignon’s picture

Couple things. I've seen that happen on the bucket name even for myself. The form error isn't printing anything around the box for some reason even though there is error messages coded. Also check your logs too because a log entry is also made when this happens.

Now to check that you have the S3 module setup correctly. Create a bucking using Drupal and not the AWS Console. If everything works correctly then you know you have your credentials setup correctly. I need to update the S3 form to say that you do not have to create the bucking in the AWS console first, this module will create the bucket for you.

Your first bucket policy looks ok, you just have to make sure that the account your access and secret keys are coming is part of that policy.

Personally what I did was create an identity specifically for the Drupal module. That way I have it "jailed" in a way.

Perignon’s picture

Assigned: Unassigned » Perignon
Status: Active » Postponed (maintainer needs more info)

IF you could dig the error out of your log that would help me a lot. I'm trying to trace down where the drupal set form error is failing to set a message.

  • Perignon committed df9fa07 on 7.x-1.x authored by Rosamunda
    Issue #2379343 by Rosamunda: Amazon S3 error: Cannot set it up
    
Rosamunda’s picture

Hi again,
Thanks for replying!
I haven't checked creating a bucket using the module, I'll try that out, but first, I'll post here the logs:

Warning: curl_setopt_array() [function.curl-setopt-array]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in StorageS3->request() (line 126 of /home/sitio/public_html/sites/all/modules/storage_api/services/s3.inc).

Referrer: .../admin/structure/storage/create-container

Notice: Undefined index: distribution_name in drupal_install_profile_distribution_name() (line 207 of /home/sitio/public_html/includes/install.inc).

Referrer: .../admin/structure/storage/create-container

Rosamunda’s picture

I've just tried creating a new bucket and I get the same screen and error type:

Warning: curl_setopt_array() [function.curl-setopt-array]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in StorageS3->request() (line 126 of /home/sitio/public_html/sites/all/modules/storage_api/services/s3.inc).

It seems that has something to do with my php settings?

Again, thanks for caring about this.
Rosamunda

Perignon’s picture

Yeah this is due to a PHP setting. I am going to assume you are on a shared host wher you have no control over the PHP settings?

Either safe_mode or open_basedir is set which will not allow cURL to perform redirections. Well documented here:
http://php.net/manual/en/function.curl-setopt.php#102121

Rosamunda’s picture

Oh I see. Is there any workaround to solve this?

Perignon’s picture

Status: Postponed (maintainer needs more info) » Active

@Rosamunda At the moment there is no work around for this unless your host allows you to override PHP settings via your .htacess file.

I will look into it as I am starting a major update of the S3 service provider to catch up to AWS's new signing method for requests (V4)

Perignon’s picture

Issue tags: +AWS, +s3

Adding tags for searching

Perignon’s picture

Rosamunda’s picture

I can override php using .htaccess. What should I do in that case?
Thanks again!!

Perignon’s picture

Turn off safe_mode and unset the open_basedir

Rosamunda’s picture

Category: Bug report » Support request
Status: Active » Fixed

It worked!
(I've to talk with my host though).
I'm changing the type of issue, because it does work, but It just need to be configured in a certain way...
THANKS!! :)

Perignon’s picture

No worries!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Perignon’s picture

Issue tags: +Storage API 7.x-1.7
synergy99’s picture

Priority: Major » Normal
Status: Closed (fixed) » Active

Hi, we've run into the same issue, again when configuring a container. However in our case, open_basedir and safe_mode aren't set.

Can you give us any other leads as to what might be causing this?

Perignon’s picture

First, what is in your logs when this happens. Both Drupal and PHP.

synergy99’s picture

Status: Active » Closed (fixed)

Thanks for the response Perignon, please excuse me for wasting your time. The client was using cpanel & we tracked it down to the 'open_basedir tweak' that overrides php.ini.

Perignon’s picture

Ok sounds good!