Phil Sturgeon
Phil Sturgeon

Reputation: 30766

AWS Elastic Beanstalk [remote rejected] (hook declined)

Following examples and tutorials for getting a PHP application up and running with AWS Elastic Beanstalk and getting errors when I try to push:

git aws.push
remote: 
remote: error: Internal Error
remote: 
To https://MYKEY:20120830T1133112489ce23684fb0061664e8de896cce922cf6d06981add734c00e356828847eb54@git.elasticbeanstalk.us-east-1.amazonaws.com/repos/4d7920466972737420256c6173746963204265616e7374616c6b204170706c69636174696f6e20456e7669726f6e6d656e6463/philsturgeon
 ! [remote rejected] HEAD -> master (hook declined)
error: failed to push some refs to 'https://MYKEY:20120830T1133112489ce23684fb0061664e8de896cce922cf6d06981add734c00e356828847eb54@git.elasticbeanstalk.us-east-1.amazonaws.com/repos/4d7920466972737420256c6173746963204265616e7374616c6b204170706c69636174696f6e20456e7669726f6e6d656e6463/philsturgeon'

What is the cause of this? Google does not seem to have any idea. I'd originally thought it due to my Host not matching, as the 2nd time you run aws.config it will not ask for a host, but after manually changing the config in .git/config it is still giving the same error.

[aws "endpoint"]
        us-east-1 = git.elasticbeanstalk.us-east-1.amazonaws.com
        ap-northeast-1 = git.elasticbeanstalk.ap-northeast-1.amazonaws.com
        eu-west-1 = git.elasticbeanstalk.eu-west-1.amazonaws.com
        us-west-1 = git.elasticbeanstalk.us-west-1.amazonaws.com
        us-west-2 = git.elasticbeanstalk.us-west-2.amazonaws.com
[alias "aws"]
        push = !git aws.elasticbeanstalk.push $@
        config = !git aws.elasticbeanstalk.config $@
[aws]
        accesskey = MYKEY
        secretkey = MYSECRET
        region = us-east-1
[aws "elasticbeanstalk"]
        host = git.elasticbeanstalk.us-east-1.amazonaws.com
        application = My First Elastic Beanstalk Application
        environment = philsturgeon

This config should be correct:

http://d.pr/i/ehwv

So, what is up here?

Upvotes: 10

Views: 2247

Answers (3)

Avi Gershon
Avi Gershon

Reputation: 81

You probably exceeded a limit in Elastic Beanstalk of 500 application versions. You need to delete old application versions via the Elastic Beanstalk Management Console, under the "Versions" tab.

Upvotes: 3

Will Palmer
Will Palmer

Reputation: 5972

I don't think it's anything on your end, specifically.

There are three related error-messages here. The outermost error is:

error: failed to push some refs to ...

Which means that, in your push operation, at least one ref (usually meaning "branch") failed to push. As you are only trying to push one branch in this operation, that's a bit redundant.

The next level in is the per-ref error, "why did so-and-so ref not push successfully?", the message for this is:

 ! [remote rejected] HEAD -> master (hook declined)

So, the remote rejected it for some reason, the reason was "hook declined". What that means is, everything was going along smoothly, but then when the server-side post-receive hook fired to actually determine if it was okay to update the pointer to "master" to tell it to use the data you just uploaded, something about the hook said "no, this is NOT okay!". The hook is just a script, usually a shell-script or perl, but it could be any executable, really. It signals failure by returning a non-zero exit status.

So, why did it return non-zero exit status? This part can be a bit tricky to determine, since the hook is under no obligation to provide any explanation to the client at all. If it wishes to, it may inform the client by outputting whatever it wants to on stderr, and those messages will appear on the client-side, prefixed with "remote: ". Fortunately for us, this particular hook has chosen to do so. Unfortunately, the actual error-message it produced was:

remote:
remote: error: Internal Error
remote:

So the actual error message, which might offer some clue as to what's going on, appears to be merely "Internal Error", which usually means the equivalent of "Unexpected situation: This is probably a bug, so I'm going to panic and abort now". I think you'll need to contact Amazon support.

Upvotes: 0

Ben Edmunds
Ben Edmunds

Reputation: 878

It's a shot in the dark but the only weird thing I see is the application name, try something without spaces of characters instead of "My First Elastic Beanstalk Application".

Upvotes: 0

Related Questions