The request signature we calculated does not match the signature you provided - amazon-web-services

I am using SES for sending email here is my code can you anybody tell me what is the problem ?
Is there anyone facing the same problem??
I have also check my credentials they are also correct.
$client = SesClient::factory(array(
'version'=> 'latest',
'region' => REGION,
'credentials' => array(
'key' => "AKIA***********",
'secret' => "AoIM6Z/clu********************",
),
));
try {
$result = $client->sendEmail([
'Destination' => [
'ToAddresses' => [
RECIPIENT,
],
],
'Message' => [
'Body' => [
'Html' => [
'Charset' => CHARSET,
'Data' => HTMLBODY,
],
'Text' => [
'Charset' => CHARSET,
'Data' => TEXTBODY,
],
],
'Subject' => [
'Charset' => CHARSET,
'Data' => SUBJECT,
],
],
'Source' => SENDER,
// If you are not using a configuration set, comment or delete the
// following line
'ConfigurationSetName' => CONFIGSET,
]);
$messageId = $result->get('MessageId');
echo("Email sent! Message ID: $messageId"."\n");
} catch (SesException $error) {
echo("The email was not sent. Error message: ".$error-
>getAwsErrorMessage()."\n");
}
}

After so much googling I found out that my credentials are wrong. Just regenerate the credentials, try it again and it should work. Another thing is that the when key includes '/', it will not work, so if your key contains '/', regenerate it.

Related

Encountering error "Request has invalid Client token" but my credentials is correct

I'm having this error when I call the startDocumentTextDetection even I have the correct credentials because I was able to upload the my pdf in s3. I also allowed Textract to call other services on my behalf.
$client = new TextractClient([
'region' => env('AWS_DEFAULT_REGION'),
'version' => '2018-06-27',
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY')
]
]);
$result = $client->startDocumentTextDetection([
'ClientRequestToken' => 'DocumentDetectionToken',
'DocumentLocation' => [ // REQUIRED
'S3Object' => [
'Bucket' => 'XXXXX',
'Name' => 'HNlLrVxE4cDqyJh0RHmSfTGtZVKzOWUG75ycHfyE.pdf',
],
],
'FeatureTypes' => ['FORMS','TABLES'],
'JobTag' => 'HNlLrVxE4cDqyJh0RHmSfTGtZVKzOWUG75ycHfyE.pdf',
'NotificationChannel' => [
'RoleArn' => 'XXXXX', // REQUIRED
'SNSTopicArn' => 'XXXXX', // REQUIRED
],
'OutputConfig' => [
'S3Bucket' => 'XXXXXX',
],
]);

Permission denied when migrating in DigitalOcean

I'm using the DigitalOcean terminal to try run a Phinx migration vendor/bin/phinx migrate -e development but I get the error "permission denied"
I have tried writing the command in different ways, I have made sure the data in my phinx.php is correct.
I'm really stuck, anyone have any experience with this?
Full Command:
root#webportal-project-name:/home/project/project-name# vendor/bin/phinx migrate -e development
Error:
-bash: vendor/bin/phinx: Permission denied
Phinx.php:
<?php
return
[
'paths' => [
'migrations' => '%%PHINX_CONFIG_DIR%%/db/migrations',
'seeds' => '%%PHINX_CONFIG_DIR%%/db/seeds'
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => 'development',
'production' => [
'adapter' => 'mysql',
'host' => 'localhost',
'name' => 'production_db',
'user' => 'root',
'pass' => '',
'port' => '3306',
'charset' => 'utf8',
],
'development' => [
'adapter' => 'mysql',
'host' => 'localhost',
'name' => 'customer_portal',
'user' => 'root',
'pass' => 'pK74He7NbqvNyFxz',
'port' => '3306',
'charset' => 'utf8',
],
'testing' => [
'adapter' => 'mysql',
'host' => 'localhost',
'name' => 'testing_db',
'user' => 'root',
'pass' => '',
'port' => '3306',
'charset' => 'utf8',
]
],
'version_order' => 'creation'
];

Sending on behalf of users with Amazon SES

Sometimes it's necessary to send an email with the reply-to address of another user. For example, if a LinkedIn user sends a connection of theirs a LinkedIn message, it makes sense to send that email from the user that sent the message, so that clicking 'reply' actually replies to the person who sent the message.
Is there a way to do this with Amazon SES?
You can pass ReplyToAddresses parameter in $ses->sendEmail() (documentation PHP V2, assuming other languages and versions will have similar structure, search for it)
$sesClient->sendEmail([
'Source' => 'sender#mail.ru',
'Destination' => 'dummy#clie.nt',
'Message' => [
'Subject' => [
'Data' => 'Spammer attack',
],
'Body' => [
'Html' => [
'Data' => 'Le Attacke!',
],
],
],
'ReplyToAddresses' => [
'reply#ema.il',
'sender#mail.ru',
'dummy#clie.nt',
]
]);

Yii2 UrlManager route a file name

I have the following rule in my UrlManager:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'cache' => null,
'rules' => [
'classic_articles/<route:.*>' => 'site/classic-articles',
// your rules go here
]
],
However it is not going to the new path when route is a file name
i.e blank%20document.pdf
It does work when there is no .pdf on the end.

Doctrine PDOException No such file or directory

I am using ZF2 with DoctrineOrm and have recently installed a local environment using vagrant on my mac running OSX (Yasomite).
Everything works as expected except I get the following error when I attempt to use Doctrine vendor tools:
./vendor/bin/doctrine-module orm:schema-tool:create --dump-sql
The error reads:
Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002]
No such file or directory' in
example.com/trunk/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
EDIT
Line 43 from the offending class: parent::__construct($dsn, $user, $password, $options);
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
public function __construct($dsn, $user = null, $password = null, array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine\DBAL\Driver\PDOStatement', array()));
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
When I dump the variables from the catch statement, they are as expected.
I can access the mysql location via adminer: http://192.168..../adminer/
And the website loads albeit with errors as I am unable to create the DB.
I remember when I originally set up my local MAMP environment having a similar problem and had to add the following line to my pdo settings:
/Applications/MAMP/tmp/mysql/mysql.sock
'connection' => [
'orm_default' => [
'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => [
'host' => 'localhost',
'port' => '3306',
'user' => 'games_cloud',
'password' => 'games_cloud',
'dbname' => 'games_cloud',
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock'
]
]
],
I can't help but think that I need to do the same thing, however I am not really sure how to.
EDIT:
SSHing into the Vbox I see the socket is located here: /var/lib/mysql/mysql.sock
What would the correct settings be to connect to this? The following does not work:
'connection' => [
'orm_default' => [
'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => [
'host' => '192.168.56.101/',
'port' => '3306',
'user' => 'games_cloud',
'password' => 'games_cloud',
'dbname' => 'games_cloud',
'unix_socket' => '/var/lib/mysql/mysql.sock' //To use Doctrine Entity Generator
]
]
],
Any help would be appreciated!
Managed to get this to work, it was a setting:
'connection' => [
'orm_default' => [
'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => [
'host' => 'localhost',
'port' => '3306',
'user' => 'games_cloud',
'password' => 'games_cloud',
'dbname' => 'games_cloud',
'unix_socket' => '/var/lib/mysql/mysql.sock'
]
]
],