S3 command failed if the time is not synced


This is already the second post about the s3sync ruby program. The first article was focused on monitoring s3sync with Zabbix.

I will talk on this one about an error I got when running the S3 synchronisation:

S3 command failed:
list_bucket prefix /data max-keys 200 delimiter /
With result 403 Forbidden
S3 ERROR: #
s3sync.rb:290:in `+': can't convert nil into Array (TypeError)
	from s3sync.rb:290:in `s3TreeRecurse'
	from s3sync.rb:346:in `main'
	from ./thread_generator.rb:79:in `call'
	from ./thread_generator.rb:79:in `initialize'
	from ./thread_generator.rb:76:in `new'
	from ./thread_generator.rb:76:in `initialize'
	from s3sync.rb:267:in `new'
	from s3sync.rb:267:in `main'
	from s3sync.rb:735

As you can see, this error is not very human-friendly! 😮 The only thing we know is that the S3 command failed because of the error can't convert nil into Array. It looks to me like an internal error within s3sync…

But after some investigation, it appears it is simply because the system date on the server is not correct. I cannot tell you how much time I spent on this one!  😯

Anyway, if you are doing automatic backups as describe on John Eberly’s blog, you need to add the following code at the top of your upload.sh script:

# update the system date
/usr/sbin/ntpdate 3.uk.pool.ntp.org 2.uk.pool.ntp.org 1.uk.pool.ntp.org 0.uk.pool.ntp.org

NB: please find below the command lines I use to install ntpdate on a Debian server:

apt-get install ntpdate
dpkg-reconfigure tzdata

, , , , , , ,


  1. #1 by Praneeth on 10 Jan 2012 - 17:10

    I’n getting exactly same error.
    even after adding this solution… I didn’t work for me.
    any idea?

    Thanks!

    10 Jan 17:08:34 ntpdate[11170]: adjust time server 109.74.206.120 offset -0.260315 sec
    S3 command failed:
    list_bucket max-keys 200 prefix praneeth delimiter /
    With result 403 Forbidden
    S3 ERROR: #
    s3sync.rb:290:in `+’: can’t convert nil into Array (TypeError)
    from s3sync.rb:290:in `s3TreeRecurse’
    from s3sync.rb:346:in `main’
    from ./thread_generator.rb:79:in `call’
    from ./thread_generator.rb:79:in `initialize’
    from ./thread_generator.rb:76:in `new’
    from ./thread_generator.rb:76:in `initialize’
    from s3sync.rb:267:in `new’
    from s3sync.rb:267:in `main’
    from s3sync.rb:735

  2. #2 by smoreau on 11 Jan 2012 - 10:37

    To be honest, I am not sure what is wrong. As I said in my post, this error message is not very helpful and doesn’t tell you where the problem is!
    I would suggest you first double-check your access key ID and your secret access key.
    If they are correct, you should try to get some help from the AWS Developer Forums: https://forums.aws.amazon.com/index.jspa
    Good luck!

(will not be published)