ERROR: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method.

If you are using the AWS route53 class and you stumbled upon the error below:

object(stdClass)[4]
  public 'error' => 
    array (size=3)
      'curl' => boolean false
      'Error' => 
        array (size=3)
          'Type' => string 'Sender' (length=6)
          'Code' => string 'SignatureDoesNotMatch' (length=21)
          'Message' => string 'The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.' (length=178)
      'RequestId' => string '078cbec9-10a2-11e7-a36b-7bfec70d5319' (length=36)
  public 'code' => int 403

Here’s what you can do, check that the credentials in your code is correct. Check both AWS Key and AWS Secret. Also ensure that forward slash at the end of the secret is present if and only if your AWS must have it.

ERROR: Unable to determine service/operation name to be authorized

If you are using the AWS route53 class and you stumbled upon the error below:

  public 'error' => boolean false
  public 'body' => 
    object(SimpleXMLElement)[5]
      public 'Message' => string 'Unable to determine service/operation name to be authorized' (length=59)
  public 'code' => int 403

Here’s what you can do. Check your hosted zone id. It should be in this form /hostedzone/Z8HJDGKXCKSH35. Ensure to include the word /hostedzone/ otherwise you’ll encounter the error above.

Check if an input is a string or a url

In this scenario, we are not checking if this is a valid url but we just want to differentiate if it is a string or a url.

var str = 'winnieverzosa.com'
isURL(str);
function isURL(str){
	if ( str.match(/.*\..*/) ){
		alert(str + ' is a URL');
	} else {
		alert(str + ' is NOT a URL');
	}
}