AWS SES Missing final '#domain' PHP SDK - php

Here's a tidbit so you don't have to spend two hours nearly tearing out your hair like I just did.
I was receiving the following error message:
Fatal error: Uncaught Aws\Ses\Exception\SesException: AWS Error Code: InvalidParameterValue, Status Code: 400, AWS Request ID: [Removed for stackoverflow], AWS Error Type: client, AWS Error Message: Missing final '#domain', User-Agent: aws-sdk-php2/2.6.6 Guzzle/3.9.1 curl/7.36.0 PHP/5.5.12
Earlier errors had shown validation taking place, (e.g. ToAddresses must be an array), so I assumed the data was validated. To a degree, I was wrong.

Despite the name, this is an error indicating that SES doesn't like one of your parameters. In my case, I had used the code on this page from the PHP SDK documentation to build up the parameter for sendEmail() and I had left Source as 'string'.
Try building your parameter for sendEmail() as $msg and using echo "sendSES msg: ".print_r($msg, true); to see exactly what's going to SES.
Postfix users may have the issue that the email address is not matching the ec2 domain name. It is a different issue, but similar in that it is SES rejecting the semantics of the data.

Related

Laravel and Guzzle HTTP '406 Not Acceptable'

I'm having an issue with Laravel and Guzzle. When ever I try this line of code with my external website 'violapractice.com' I get an error:
$res = $client->request('GET','http://violapractice.com/articles.json.php');
Client error: `GET http://violapractice.com/articles.json.php` resulted in a `406 Not Acceptable` response: <html><head><title>Error 406 - Not Acceptable</title><head><body><h1>Error 406 - Not Acceptable</h1><p>Generally a 406 e (truncated...)
I've tried requesting a none php file and get the same error:
$res = $client->request('GET','http://violapractice.com/test.html');
The odd thing is, if I use any other URL, like https://stackoverflow.com the GET request goes through with no issue.
Also, I tired using postman on http://violapractice.com/articles.json.php and it worked fine.
I've never experienced anything like this before. Ideas anyone?
In the end, I ended up turning off ModSecurity in the violapractice.com cpanel. I felt that the risk in doing this was minimal because the website is only accessible through admin login and has many layers of security.

Getting 411 error bad request in Evernote

We have three environments, Dev, QA and Prod.
We have a stable PHP running that connects with evernote , get token and fetch content.
we updated our QA environment to PHP 7.0 and now when via evernote when we try to fetch Token it returns
Invalid auth\/bad request (got a 411, expected HTTP\/1.1 20X or a redirect)
Here is the code
$oauth = new \OAuth($this->consumerKey, $this->consumerSecret);
return $oauth->getRequestToken($this->getEndpoint('oauth'), $callbackUrl);
I have checked that consumerKey etc and everything is correct.
I am not sure what error could be here since 411 is normally when you need to send content length, but in Evernote API they dont mention anything like this
Is this due to PHP 7.0 ?
Any help will be appreciated
Thanks
Yes, you probably need to send the content length.
Does Evernote change the API validation for the Content-Length?
I see there is another workaround proposed on Github.

ISSUU: Upload not working - Response Code: 999 Internal server error

I'm trying to upload files via the API (issuu.document.upload). It worked in the past. But on new files I receive always the following response error:
{"rsp":{"_content":{"error":{"code":"999","message":"a66125aeaff42e3a893a985fdc9b659587880484 - Internal server error"}},"stat":"fail"}}
The document also does not show up in "My Publications" (http://issuu.com/home/publications)
There is no API documentation about this error code...
Problem solved (the ISSUU developers fixed it). From the ISSUU support team: "... It seems like there was some problems with our API servers, ..."

Subscribe to timeline updates - (400) callbackUrl must be a valid HTTPS URL

I've been working with the Mirror API, specifically the php quick start project. I'm receiving an error after attempting to subscribe to timeline updates:
An error occurred: Error calling POST https://www.googleapis.com/mirror/v1/subscriptions: (400) callbackUrl must be a valid HTTPS URL
I do have SSL enabled and working on my test server.
In the subscribe_to_notifications function on mirror-client.php (line 111) I see a reference to the callbackUrl: $subscription->setCallbackUrl($callback_url);
However, I am not able to find where to change this. Should it be set to notify.php? Can someone get me pointed in the right direction?
Found out the issue, in config.php my $base_url needed to be set to the secure version.

Am i using the API V2 or V3 in this piece of code?

My live, staging and localhost had a page where it had a map and store finder.
6 months down the line this now does not work and havent touched the code. I have renewed my API key and still no luck. Now i know the API V2 is now not in use and im wondering if i am using the wrong code (confused myself). In my store finder i have this url:
$url = "http://maps.google.co.uk/maps/geo?q=".urlencode($this->input->post('postcode'))."&output=json&key=MYKEY";
Now reading this page ( https://developers.google.com/maps/documentation/geocoding/#JSON ) this has changed but i just cant seem to get a valid url working!
The error i get is: Message: file_get_contents(http://maps.google.co.uk/maps/geo?q=sr3+4as&output=json&key=MYKEY): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
And when i type the url string into google i get this message:
We're sorry...
... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.
If someone can guide me to if my url string is wrong above OR if this is another issue i would appreciate it.
Thanks!
According to the upgrade guide this endpoint URL:
http://maps.google.co.uk/maps/geo
Is using the v2 geocoding API.
Developers switching from v2 may be using a legacy hostname — either maps.google.com, or maps-api-ssl.google.com if
using SSL. You should migrate to the new hostname: maps.googleapis.com.
This URL based on the information in the update guide works for me:
http://maps.googleapis.com/maps/api/geocode/json?address=nebraska&sensor=false

Categories