PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Error code: 400

s2Member Plugin. A Membership plugin for WordPress®.

Error code: 400

Postby drbyte » November 9th, 2011, 5:11 pm

Error code: 400. Error Message: Unable to update existing Amazon® S3 ACLs. Unable to update existing Amazon® S3 Bucket Policy. Bad Request

Hi Guys

This is waht I am getting all day long with a new project. Everything is config correctly. I do wait over 30 min before making any changes but S2 Still can't manage to create the bucket policy. There is no bucket policy for the bucket.

Jason, is there anyway I can override the current 15 min waiting period when config CloudFront? It's really time consuming.

What Would be the default bucket policy be?

Thank you
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby drbyte » November 9th, 2011, 6:34 pm

This is what I have now

<b>Fatal error</b>: s2Member was unable to generate an RSA-SHA1 signature. Please make sure your installation of PHP is compiled with OpenSSL: `openssl_sign()`.
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby drbyte » November 9th, 2011, 6:50 pm

CouldFront

Response contains invalid JSON
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby drbyte » November 9th, 2011, 7:20 pm

OK, I think Age is playing a big factor in my life now. Maybe I need LASIK

pk- does not look at all like rsa-

All good now :)
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby Cristián Lávaque » November 12th, 2011, 1:03 am

Glad it's working. :)

What was the problem?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Error code: 400

Postby drbyte » November 12th, 2011, 7:11 am

Hi Cris

Well, when you first create a CloudFront Key Pairs it gives a files to download which has your private key. You need to keep that file and never delete it. Now, I had 2 files in my doc, a private and a public which i must have downloaded when i first created the pairs and did not notice the file names (LASIK) . So i was entering the public key file which starts with rsa- . I needed the one which starts with pk-

That's why I was getting all kind of errors.

Something else:

I noticed that when you let S2M re-create both (download & Stream) using CloudFront and CNAMES, something I suppose have to do with AWS, it disables one of them and the other looses it's info. I would have manually to disable and delete both instance which takes almost 30 min, then S2M will be able to re-create both without any errors.

Sam
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby Cristián Lávaque » November 12th, 2011, 3:23 pm

Ah, I see. Thanks for explaining it to me. :)

I noticed that when you let S2M re-create both (download & Stream) using CloudFront and CNAMES, something I suppose have to do with AWS, it disables one of them and the other looses it's info. I would have manually to disable and delete both instance which takes almost 30 min, then S2M will be able to re-create both without any errors.


I'll show that to Jason in case he can improve it in some way.

Thanks!
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Error code: 400

Postby Jason Caldwell » November 15th, 2011, 6:59 pm

Thanks for the great feedback here.

s2Member can still use some improvement in the way it handles the re-configuration of the distros in a scenario where it's already done so in the past. In the mean time, you can speed the process up a little bit by logging into your Amazon console and perform the following actions yourself, right before you tell s2Member to re-configure things for you.

Disable and then delete both of your previous CloudFront Distros. This may still take some time, even if you do it yourself, given the nature of the CloudFront system, but it will reduce the waiting periods and the number of errors that s2Member spits back during re-configuration.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Error code: 400

Postby drbyte » November 23rd, 2011, 5:34 am

Hi Jason

Did not get a notification on the update of this thread..Sorry

OK, I am still getting this error in new Installation

Error code: 400. Error Message: Unable to update existing Amazon® S3 ACLs. Unable to update existing Amazon® S3 Bucket Policy. Bad Request

I checked every single field including the private key.

It keep giving me the error above. It takes about 15 min with Amazon console but I'm guessing with S2m it's about 30 min. 15 min for each distribution.

It creates the distribution (download and stream) correctly. But It's unable to create the bucket policy.

I have this on one that is working on another site:

Code: Select all
{
   "Version": "2008-10-17",
   "Id": "7756bb18649fb598206XXXXXXe7765b2",
   "Statement": [
      {
         "Sid": "s2Member/CloudFront",
         "Effect": "Allow",
         "Principal": {
            "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E1IDUXXXXXXX04Y"
         },
         "Action": "s3:GetObject",
         "Resource": "arn:aws:s3:::bucket name/*"
      }
   ]
}


I tried creating a new policy to the new bucket by copying the above and changing the CF Origin Access Identity and The bucketname. No luck. Can I use the same identity and the ID above or those needs to be different Jason

I'm not sure what's the problem but I'm guessing if I did delete and try to recreate the distribution more than 3 time, then I would have to wait about 2 and half hours before I try again. maybe more.

Thank You

Sam
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby Jason Caldwell » November 23rd, 2011, 11:20 am

Thanks Sam. Investigating this now.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Error code: 400

Postby drbyte » November 23rd, 2011, 2:05 pm

Thanks Jason

Spent an access of 5 hours on this since last night. :cry:
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby Jason Caldwell » November 24th, 2011, 10:18 pm

Thanks for your patience.
drbyte wrote:Hi Jason

Did not get a notification on the update of this thread..Sorry

OK, I am still getting this error in new Installation

Error code: 400. Error Message: Unable to update existing Amazon® S3 ACLs. Unable to update existing Amazon® S3 Bucket Policy. Bad Request

I checked every single field including the private key.

It keep giving me the error above. It takes about 15 min with Amazon console but I'm guessing with S2m it's about 30 min. 15 min for each distribution.

It creates the distribution (download and stream) correctly. But It's unable to create the bucket policy.

I have this on one that is working on another site:

{
"Version": "2008-10-17",
"Id": "7756bb18649fb598206XXXXXXe7765b2",
"Statement": [
{
"Sid": "s2Member/CloudFront",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E1IDUXXXXXXX04Y"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket name/*"
}
]
}

I tried creating a new policy to the new bucket by copying the above and changing the CF Origin Access Identity and The bucketname. No luck. Can I use the same identity and the ID above or those needs to be different Jason

I'm not sure what's the problem but I'm guessing if I did delete and try to recreate the distribution more than 3 time, then I would have to wait about 2 and half hours before I try again. maybe more.

Thank You

Sam

So it's working on one site, but not on another?
I assume you're using a different underlying Bucket on each of these sites, correct?
If so, does your Bucket Name, on the site that is NOT working, all lowercase,
following these Bucket naming guidelines?

See: http://docs.amazonwebservices.com/Amazo ... tions.html
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Error code: 400

Postby drbyte » November 24th, 2011, 11:17 pm

Hi Jason

Thank you for taking the time to reply on Thanksgiving Day

Everything is within the Amazon guidelines but I am suspecting it has to do with SSL.

Sorry did not mention that I am running multisite version of WordPress. Both on SSL and using Sub-directories

Yes, each site has it's own bucket.

Having said that, been trying different options and I was successful with the following:

Under WodPress/S2M Pro Multisite, Multisite and User Management Plugin - I was able to use one bucket for both sites using the same credentials. What I did not do on the second S2M installation is have it to configure S3 and CloudFront. I just entered the keys.

When I logged to the second site using a registered user from the main site I got a access denied. Solved it by disabling this in the JWPlayer code. "count_against_user" => false) and implementing the user-can to safeguard the content

Just if any want to know I am using this:

Code: Select all
<?php if (current_user_can("access_s2member_level1")){ ?>
    Content for Members who CANNOT access Level #1 on this Blog.
<?php } else if(current_user_can_for_blog(ID"access_s2member_level1")) { ?>
Your Stuff in here
<?php } else if(is_user_not_logged_in()) { ?>
    Some public content.
<?php ?> 




It's not good if you are trying to count the number of view but no need in my case.

Then I got a CloudFront streaming Error and managed to solve this by entering the streaming bucket name abc.cloudfront.net in the Amazon® CloudFront CNAME for Streaming Files ( optional ): field (S2M Backend)

I just made sure none of the 2 options are selected when saving the configuration

By doing so, I managed to have both sites stream the same movies from Amazon using the same bucket and the same CloudFront distributions, and make it accessible to all of my members.

Please advice of any of the above have negative effects on the sites. Thank you Jason..Have a great evening.

Please let me know if SSL has anything to do with the errors.

Sam
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby drbyte » December 5th, 2011, 9:24 am

Hi Jason

Sorry to keep bugging you with this but I keep getting Error code: 400. Error Message: Unable to update existing Amazon® S3 ACLs. Unable to update existing Amazon® S3 Bucket Policy. Bad Request

This is in a new S2M install. It creates the ClodFront distribution correctly but keeps giving me the error above.

This is on a new WordPress multisite installation. all keys are correct. unless you can't use the same keys more than once. I also tried multiple bucket names just in case one was bad, same thing.

Unless otherwise there is something wrong with my account with Amazon

Thank you

Sam
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby Jason Caldwell » December 7th, 2011, 3:29 am

Scratch this. See: viewtopic.php?f=4&t=15853&p=56155#p56155

Hi Sam. Sorry for the delayed response.
Been working on WordPress 3.3 issues, and the release of s2Member v111206.
http://wordpress.org/extend/plugins/s2member/changelog/

If this is still a problem for you, please unzip and upload the attached DEBUG file. Allow it to override your existing copy of /s2member/includes/classes/files-in.inc.php ( please make a backup of the original file though ). Please do this against an existing installation of s2Member v111206.

Now, once this debugging file is in place, please run your tests again. Then check for the existence of: /wp-content/s2-s3-debug.log. Please post the log entries from that file so I can look for possible explanations.

Once your tests are completed, replace the original file, and get rid of the DEBUG file.
files-in.inc.php.zip
(15.21 KiB) Downloaded 45 times
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Error code: 400

Postby drbyte » December 7th, 2011, 5:02 am

Hi Jason

Thank you for looking into this error

I upgraded S2 and got me the log file.

Code: Select all
array (
  'option_value' => '',
  'option' => 'pro_recaptcha_private_key',
  's3c' =>
  array (
    'bucket' => 'xxxxxxxxxxxxx',
    'access_key' => 'xxxxxxxxxxxxxx',
    'secret_key' => 'xxxxxxxxxxxxxxxxxxx',
  ),
  'cfc' =>
  array (
    'distros_s3_access_id' => '455e7e83exxxxxxxxxxxxxx5cc617baf7ddc08xxxxxxxxxxxxxxxxxxxxxxxxxxx9876xxxxxxxxf6802f0',
  ),
  's3_date' => 'Wed, 07 Dec 2011 09:17:47 GMT',
  's3_location' => '/?policy',
  's3_domain' => 'xxxxxxxxxxxxxxxxx.s3.amazonaws.com',
  's3_signature' => 'gv+cxxxxxvtG5Rxxxxxxxxxxxxxxxxxx=',
  's3_args' =>
  array (
    'method' => 'PUT',
    'body' => '{"Version":"2008-10-17","Id":"xxxxxxxbb1xxxxxxxxxx65b2","Statement":[{"Sid":"s2Member/CloudFront","Effect":"Allow","Principal":{"CanonicalUser":"455e7exxxxxxxxxxx17baf7xxxxxxxx7ed841c724a861c129xxxxxxxxxxx4f6xxxxxxxxxxx2f0"},"Action":"s3:GetObject","Resource":"arn:aws:s3:::xxxxxxxx/*"}]}',
    'headers' =>
    array (
      'Host' => 'xxxxxxxx.s3.amazonaws.com',
      'Content-Type' => 'application/json',
      'Date' => 'Wed, 07 Dec 2011 09:17:47 GMT',
      'Authorization' => 'AWS AxxxxxxxxxxQQ:gvxxxxxxxxxFpCSwxxxxxxxxxx90i8s=',
    ),
  ),
  's3_response' =>
  array (
    'code' => 200,
    'message' => 'OK',
    'headers' =>
    array (
      'x-amz-id-2' => 'sn2wClZ0xxxxxxxxxxxxxxCLxxxxxxxx99xxxxxxxxxxxxxxU6iXg',
      'x-amz-request-id' => 'FA8xxxxxxx56676xxxxxxxDAC',
      'date' => 'Wed, 07 Dec 2011 09:17:50 GMT',
      'content-length' => '0',
      'connection' => 'keep-alive',
      'server' => 'AmazonS3',
    ),
    'body' => '',
    'response' =>
    array (
      'headers' =>
      array (
        'x-amz-id-2' => 'sn2wClZ06ExxxxxxxxxxfHvMWa5xxxxxxxxxxLSK29xxxxxxxxxxU6iXg',
        'x-amz-request-id' => 'Fxxxxxxxx56676xxxxxxxxC',
        'date' => 'Wed, 07 Dec 2011 09:17:50 GMT',
        'content-length' => '0',
        'connection' => 'keep-alive',
        'server' => 'AmazonS3',
      ),
      'body' => '',
      'response' =>
      array (
        'code' => 200,
        'message' => 'OK',
      ),
      'cookies' =>
      array (
      ),
      'filename' => NULL,
    ),
  ),
  's3_owner_tag' =>
  array (
    0 => '<Owner><ID>80d89cf4xxxxxxxxxxxxxxe718xxx2e3exxxxxxxxxxxxb145c200</ID><DisplayName>xxxxxxxxx</DisplayName></Owner>',
    1 => '<ID>80d8xxxxxx7a748xxxxxxxxxx7xxxx3e2ecxxxxxxxxxxxx145c200</ID><DisplayName>xxxxxxxx</DisplayName>',
  ),
  's3_owner_id_tag' =>
  array (
    0 => '<ID>80d8xxxx4790c57a7xxxxxxxxxxxc7296xxxxxxxxxxx5c200</ID>',
    1 => '80dxxx4790c5xxxxxxxxxxx7xxxxx2e3e2xxxxxxxxxa2b145c200',
  ),
  's3_owner_display_name_tag' =>
  array (
    0 => '<DisplayName>xxxxxxxxxx</DisplayName>',
    1 => 'xxxxxxxxx',
  ),
  's3_owner' =>
  array (
    'access_id' => '80xxxxxxxxcf4790c5xxxxxxxxxxxxxxxxe2ec7xxxxxxxxxxx145c200',
    'display_name' => 'xxxxxxxxxxx',
  ),
  's3_acls_xml' => '<AccessControlPolicy><Owner><ID>80d89cf4xxxxxxxxxxxxxxxx71xxx12exxxxxxxxxx6a2b145c200</ID><DisplayName>xxxxxxx</DisplayName></Owner><AccessControlList><Grant><Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><ID>80d8xxxxxxxxxxxxxe718712e3e2xxxxxxxxxxxx45cxxxx00</ID><DisplayName>xxxxxxxxx</DisplayName></Grantee><Permission>FULL_CONTROL</Permission></Grant><Grant><Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"><ID>455exxxxxxxxxxx7e46bcf4667axxxxxxxxxxxxxxxxee22177dexxxxxxxxxxxxxxxf6802f0</ID><DisplayName>s2Member/CloudFront</DisplayName></Grantee><Permission>READ</Permission></Grant></AccessControlList></AccessControlPolicy>',
  's3_policy_json' => '{"Version":"2008-10-17","Id":"7xxxxxxx56bxxxxxxxxxxxxxxxxxx6xxxxxx2","Statement":[{"Sid":"s2Member/CloudFront","Effect":"Allow","Principal":{"CanonicalUser":"455xxxxxxxxx667a5c36c617baf7xxxxxxxxxxxxxxx129ee2xxxxxxx2cxxxxxxxx02f0"},"Action":"s3:GetObject","Resource":"arn:aws:s3:::xxxxxxxxxxxxxx/*"}]}',
)


I wont be able to post the original file in here Jason. I has all my info (Scary)

Any way, I copied the policy above to the bucket policy and it seems OK. It's still creating the CloudFront distribution. Once it's done I will try and see if it's working

Thank You

UPDATES: I am still getting this error

Unable to auto-configure Amazon® CloudFront Distributions.
Error code: 400. Error Message: Unable to update existing Amazon® S3 ACLs. Unable to update existing Amazon® S3 Bucket Policy. Bad Request

The ClouldFront distribution was created but nothing else

One other problem I am facing Jason

Using S3/CloudFront/JWPlayer/Streaming/HTML5 fallback - NO Download

Code: Select all
<div id="jw-container"></div>
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
<?php
$cfg = array ("file_download" => get_post_meta(get_the_ID(), "movie", true), "url_to_storage_source" => true, "count_against_user" => true); ?>

<?php if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?>

<script type="text/javascript">
        jwplayer("jw-container").setup({modes: /* JW Player. */
        [
            /* First try real-time streaming with Flash player. */
            {type: "flash", provider: "rtmp", src: "/jwplayer/player.swf",
                config: {streamer: "<?php echo $mp4["streamer"]; ?>", file: "<?php echo $mp4["file"]; ?>"}},

           /* Else, try an HTML5 video tag. */
            {type: "html5", provider: "video",
                config: {file: "<?php echo $mp4["url"]; ?>"}},       

        ],
      autostart: true,
      controlbar: "bottom",
      skin: "http://www.site.com/glow.zip",
        /* Set video dimensions. */ width:480, height: 320
        });
    </script>


Form the 1st to the 4th. I got about 600GB of AWS data transfer out. all what I was doing is changing my files from using Wowza to AWS. I was viewing the post for seconds of a time to check if the movie is playing correctly. But not more that 5 second at at time

But after taking this out form the code above

Code: Select all
/* Else, try an HTML5 video tag. */
            {type: "html5", provider: "video",
                config: {file: "<?php echo $mp4["url"]; ?>"}},


The data out is barely moving

I contacted Amazon and they are looking into this now.

Here are some of the out log files

Code: Select all
<OperationUsage>
        <ServiceName>AmazonS3</ServiceName>
        <OperationName>GetObject</OperationName>
        <UsageType>DataTransfer-Out-Bytes</UsageType>
        <Resource>xxxxxxxxxx</Resource>
        <StartTime>12/04/11 04:00:00</StartTime>
        <EndTime>12/04/11 05:00:00</EndTime>
        <UsageValue>19750475516</UsageValue>
    </OperationUsage>

That's 18.3940637074411 18GB of transfer


Code: Select all
<OperationUsage>
        <ServiceName>AmazonS3</ServiceName>
        <OperationName>GetObject</OperationName>
        <UsageType>DataTransfer-Out-Bytes</UsageType>
        <Resource>xxxxxxxxx</Resource>
        <StartTime>12/03/11 13:00:00</StartTime>
        <EndTime>12/03/11 14:00:00</EndTime>
        <UsageValue>57150542691</UsageValue>
    </OperationUsage>

That's 57150542691 53GB of transfer ..Impossible


Last month was not even 20% of that. The only diffrence is that I was not updating my posts.
Total posts being updated from the 1st to the 4th..I would say about 800 of them

I did not have many user log ins during those days too. Most of the post views where mine

I got this form amazon now:

At this moment we are unable to ascertain the reason for the large volume of transfer on your S3 Bucket. We have requested the relevant team to investigate your matter and we hope get back to you as soon as possible.

Sam
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby drbyte » December 7th, 2011, 6:16 pm

Hi Jason

I think there is a bug in the multisite installation of WordPress and S2. I can't pinpoint the problem but here's what's happening

I believe all sub sites are copying the main site credentials of S3 and CloudFront. Meaning it's not able to recreate the bucket policy because there is one present and it's not able to change it becuase it belongs to the parent site. I think this problem only exist if you set the multisite configured as a sub directory not as a sub domain. Meaning http://www.sub.site.com Vs. http://www.site.com/subsite

I did few tests just to get my theory in place.

I entered all AWS credintial form the parent site to other sub sites without having it to reconfigure and recreate bucket policy and CloudFront distributions.

It did not work becuase the sub site was not configured correctly and it was looking for a CloudFront streaming server that does not exist.

Having said that, if you manually enter CloudFront where it says:
Yes, I want s2Member to auto-configure using custom CNAMES that I'll setup
Amazon® CloudFront CNAME for Streaming Files ( optional ):
Enter the parent site CloudFront distribution server name: xxxxxxx.cloudfront.net

Save and make sure the top (reconfigure) option is NOT marked

Now, create a post and use the JWPlayer along with CloudFront streaming. Use a file that is in the main bucket you created by the parent site...Walla.. Works fine.

Can you please confirm this with WordPress Multisite set as sub directory

Thank you
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby Jason Caldwell » December 8th, 2011, 4:53 am

Thank you Sam.
I'm reading through this now.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Error code: 400

Postby Jason Caldwell » December 8th, 2011, 6:55 am

OK. What you said here...
I believe all sub sites are copying the main site credentials of S3 and CloudFront. Meaning it's not able to recreate the bucket policy because there is one present and it's not able to change it becuase it belongs to the parent site. I think this problem only exist if you set the multisite configured as a sub directory not as a sub domain. Meaning http://www.sub.site.com Vs. http://www.site.com/subsite

Not exactly. The underlying issue here is with s2Member's auto-configuration routines for the Amazon S3/CloudFront combo, which are designed to setup and configure various Amazon requirements between your Bucket and your Distributions. s2Member assumes that you're creating a new Amazon® S3 Bucket, for each instance of s2Member. So inside a Multisite Network installation, each instance of s2Member ( i.e. each Child Blog in the Network ) should be associated with a Bucket that is dedicated to serving protected files for that Child Blog ( i.e. for that instance of s2Member ).

s2Member creates a new Origin Access Identity for each set of Distributions that it configures ( one Origin Access Identity for each instance of s2Member ). It does this, because in order for your CloudFront Distributions to be connected to an Amazon S3 Bucket, s2Member has to update the Amazon S3 Bucket Policy with the Origin Access Identity that it created. Unfortunately, s2Member's auto-configuration routines are NOT yet capable of piecing together existing Bucket Policies in an attempt to preserve any existing permissions granted for other Distributions. It simply assumes that each instance of s2Member is going to run with a Bucket dedicated to that instance.

I just took a quick look at the source code that handles this. It's not a quick fix by any standard. The Bucket ACLs, Policies, and the underlying configuration of s2Member's options are not designed to allow for this. At least, not through it's auto-configuration routines.

Until we have this issue resolved, here are some possible solutions:


1. Use only ONE Bucket for each instance of s2Member ( problem solved ).

2. Or, if you have multiple Child Blogs on a Multisite Network, and you really need to use the same Bucket for all Child Blogs across the entire Network, you can start fresh on the Main Site of your Blog please ( i.e. usually Blog ID #1 ). Allow s2Member to run it's auto-configuration routines for Amazon S3/CloudFront. Once everything is configured properly on the Main Site of your Network, create this directory and file:

/wp-content/mu-plugins/s2-site-options.php
( these are MUST USE plugins, see: http://codex.wordpress.org/Must_Use_Plugins )
Code: Select all
<?php
add_filter 
("ws_plugin__s2member_options_before_checksum", "s2_site_options"); function s2_site_options (&$options = array ())
    {
        if (is_multisite () && is_array ($site_options = get_site_option ("ws_plugin__s2member_options")))
            foreach ($site_options as /* Use global Amazon® config. */ $key => $value)
                if (preg_match ("/^amazon_(?:s3|cf)_files_/", $key))
                    $options[$key] = $value;
        /**/
        return /* Options by reference. */ $options;
    }
?>
s2-site-options.zip
(449 Bytes) Downloaded 35 times

! With this file in place, there is no need to configure Amazon S3/CloudFront on any of your other Child Blogs in the same Network. All existing and/or future Child Blogs will essentially come pre-configured with your current configuration on the Main Site, with respect to Amazon S3/CloudFront. Some might see this as a great time-saver.

WARNING: checking the box in the s2Member UI panel, to re-configure your Amazon/CloudFront Distributions, on any other Child Blog in the Network ( or on any other remote installation of WordPress, for that matter ), will effectively destroy what you've accomplished. Don't do it. Auto-configure your Amazon S3/CloudFront Distributions on the Main Site of your Network only. All other Child Blogs in the Network will use that configuration, and should NOT be re-configured again.

If you do this by accident, go back to your Main Site and re-run s2Member's auto-configuration routines all over again. Child Blogs will inherit their configuration from the Main Site.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Error code: 400

Postby Jason Caldwell » December 8th, 2011, 7:04 am

Thanks for reporting this important issue Sam.
Form the 1st to the 4th. I got about 600GB of AWS data transfer out. all what I was doing is changing my files from using Wowza to AWS. I was viewing the post for seconds of a time to check if the movie is playing correctly. But not more that 5 second at at time

But after taking this out form the code above

Code: Select all
Code: Select all
    /* Else, try an HTML5 video tag. */
                {type: "html5", provider: "video",
                    config: {file: "<?php echo $mp4["url"]; ?>"}},
I'm not sure, but it sounds like something is preloading somewhere. You might check with JWPlayer to see if there are any known bugs in this regard. Otherwise, you said that you were moving files around? Is it possible that there are redirects involved somehow, causing files to be downloaded inadvertently?

I just took another look through s2Member's source code. s2Member never issues a file_get_contents(), or anything like that, on an Amazon®-hosted file. It will redirect visitors to Amazon®, based on a multitude of factors and your configuration; but it won't download the file and drive up bandwidth. Hmm, let me know if you have anything more on this topic. I'm curious about why this happened.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Error code: 400

Postby drbyte » December 8th, 2011, 12:35 pm

Thank you Jason

Until we have this issue resolved, here are some possible solutions:


1. Use only ONE Bucket for each instance of s2Member ( problem solved ).


That's what I have been trying to do. One bucket per one S2 instance. But 400 error kept coming and that's why I was forced to use the one bucket method.

Everything seems OK including CloudFront distributions that S2 creates, but when it comes to creating the bucket policy it fails. S2 even creates the grantee for that specific bucket but that's all.

amazon-01.jpg


I will use your second option if there is no way out of this.

I am still waiting on Amazon Support to figure out the huge amount of usage during the first 4 days. I have been monitoring the usage since then (Not editing post or having the HTM5 as a second option)

Usage between
5th/Dec - 8th/Dec

611.198 to 621.152

usage between 1/Dec to 5/Dec
0 to 611.198GB

Anyhow, sorry for taking your time on this. I will keep trying and post any new finding here

Thank you

Sam
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby Jason Caldwell » December 9th, 2011, 12:22 am

Scratch this. See: viewtopic.php?f=4&t=15853&p=56155#p56155

Hi Sam. Thanks for the follow-up.

I think we've just discovered why this is happening. It has to do with the "Id" property in the Bucket Policy. s2Member uses an MD5 hash of "s2Member/CloudFront", which would be the same across multiple instances of s2Member. Thus, the Id field would be rejected with a 400 error code by Amazon.

I'm attaching a patch file for you. Please unzip and allow the attached file to override your existing copy of: /s2member/includes/classes/files-in.inc.php. Please use this patch against an existing installation of s2Member v111206.

files-in.inc.php.zip
(15.17 KiB) Downloaded 34 times
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Error code: 400

Postby Jason Caldwell » December 9th, 2011, 12:44 am

Scratch this. See: viewtopic.php?f=4&t=15853&p=56155#p56155

Update: This patch has been revised on the advice of two beta testers.
If you downloaded the previous patch file and still had trouble, please update to this latest patch please.
files-in.inc.php.zip
(15.17 KiB) Downloaded 45 times
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Error code: 400

Postby drbyte » December 9th, 2011, 12:48 am

Hi Jason

I just tried that and it is still giving 400 error. It creates everything else but the bucket policy

I am waiting on CloudFront to finish creating the distribution then I will try again

Thank you

Sam
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

Re: Error code: 400

Postby Jason Caldwell » December 9th, 2011, 12:51 am

Scratch this. See: viewtopic.php?f=4&t=15853&p=56155#p56155

Jason Caldwell wrote:Update: This patch has been revised on the advice of two beta testers.
If you downloaded the previous patch file and still had trouble, please update to this latest patch please.

files-in.inc.php.zip
(15.17 KiB) Downloaded 33 times
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Next

Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron