AWS API Gateway and DynamoDb Serialization Exception Response Codes - amazon-dynamodb

This question resolves how to fix serializaion errors caused by a bad template, but if they are cause by input errors like a missing param, they are returned with a 200.
I'm trying to add a response template for errors using the CDK on an DynamoDb integration
read_integration_responses=[aws_apigateway.IntegrationResponse(
status_code="200",
response_templates= {"application/json":read_response_template}),
aws_apigateway.IntegrationResponse(status_code="400",
response_templates={"text/html": "Client Error"},
selection_pattern="400" )
])
The 200 works fine, but I get a 500 server error when I have an error. The logs are no help:
Fri Feb 10 21:37:37 UTC 2023 : Sending request to
https://dynamodb.us-east-1.amazonaws.com/?Action=Query Fri Feb 10
21:37:37 UTC 2023 : Received response. Status: 400, Integration
latency: 6 ms Fri Feb 10 21:37:37 UTC 2023 : Endpoint response
headers: {Server=Server, Date=Fri, 10 Feb 2023 21:37:37 GMT,
Content-Type=application/x-amz-json-1.0, Content-Length=60,
Connection=keep-alive,
x-amzn-RequestId=HB4E7S3FS0NIMM44OQRN6RPBEBVV4KQNSO5AEMVJF66Q9ASUAAJG,
x-amz-crc32=3948637019} Fri Feb 10 21:37:37 UTC 2023 : Endpoint
response body before transformations:
{"__type":"com.amazon.coral.service#SerializationException"} Fri Feb
10 21:37:37 UTC 2023 : Execution failed due to configuration error:
Output mapping refers to an invalid method response: 400 Fri Feb 10
21:37:37 UTC 2023 : Method completed with status: 500
Per the method documentation selection_pattern is a string that matches the response code.

Related

Push for pass on Passbook

I try send push notification on Passbook by ApnsPHP library
$config['production'] = DOCROOT . '/my_cert.pm';
$config['entrust'] = DOCROOT . '/entrust_root_certification_authority_2048.pem';
$config['passphrase'] = '';
$token = $push_info->push_token;
$text = 'TEST';
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION, $config['production']
);
if ($config['passphrase'] <> '') {
$push->setProviderCertificatePassphrase($config['passphrase']);
}
$push->setRootCertificationAuthority($config['entrust']);
$message = new ApnsPHP_Message();
$message->addRecipient($token);
$push->connect();
$message->setSound();
$message->setText($text);
$push->add($message);
$push->send();
$push->disconnect();
$aErrorQueue = $push->getErrors();
if (!empty($aErrorQueue)) {
echo 'Error - ' . print_r($aErrorQueue, true);
}
Output
Wed, 20 Mar 2019 11:01:16 +0000 ApnsPHP[6467]: INFO: Trying tls://gateway.push.apple.com:2195...
Wed, 20 Mar 2019 11:01:17 +0000 ApnsPHP[6467]: INFO: Connected to tls://gateway.push.apple.com:2195.
Wed, 20 Mar 2019 11:01:17 +0000 ApnsPHP[6467]: INFO: Sending messages queue, run #1: 1 message(s) left in queue.
Wed, 20 Mar 2019 11:01:17 +0000 ApnsPHP[6467]: STATUS: Sending message ID 1 [custom identifier: unset] (1/3): 87 bytes.
Wed, 20 Mar 2019 11:01:18 +0000 ApnsPHP[6467]: INFO: Disconnected.
But device didn't try push my server (all request write in log, he is empty).
I cant understand what wrong... some ideas?
The thing is that Apple has made a change in the export of certificates for signing. Now it has a simplified mechanic: the certificate bundle (pass cert and Apple certificate) is immediately exported to "*.pem"

Firebase checking deployed files

When I run firebase deploy command, I would like to know which files are deployed.
I tried firebase deploy --debug, but I don't see any information about uploaded files.
[2018-05-25T09:48:26.423Z] ----------------------------------------------------------------------
[2018-05-25T09:48:26.426Z] Command: /usr/local/bin/node /usr/local/bin/firebase deploy --debug
[2018-05-25T09:48:26.427Z] CLI Version: 3.18.4
[2018-05-25T09:48:26.427Z] Platform: darwin
[2018-05-25T09:48:26.427Z] Node Version: v9.2.0
[2018-05-25T09:48:26.428Z] Time: Fri May 25 2018 11:48:26 GMT+0200 (CEST)
[2018-05-25T09:48:26.428Z] ----------------------------------------------------------------------
[2018-05-25T09:48:26.439Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2018-05-25T09:48:26.440Z] > authorizing via signed-in user
[2018-05-25T09:48:26.441Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[2018-05-25T09:48:26.442Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
{ refresh_token: '1/sNSNg7xxbzwVujBEzRAQ2eZHkEuT0d6A2jVVUGa-e9Jgrc8NASizU4RK7MEmNnov',
client_id: '563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com',
client_secret: 'j9iVZfS8kkCEFUPaAeJV0sAi',
grant_type: 'refresh_token',
scope: 'email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase openid' }
Fri May 25 2018 11:48:26 GMT+0200 (CEST)
[2018-05-25T09:48:26.585Z] <<< HTTP RESPONSE 200 cache-control=no-cache, no-store, max-age=0, must-revalidate, pragma=no-cache, expires=Mon, 01 Jan 1990 00:00:00 GMT, date=Fri, 25 May 2018 09:48:26 GMT, vary=X-Origin, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, x-content-type-options=nosniff, x-frame-options=SAMEORIGIN, x-xss-protection=1; mode=block, server=GSE, alt-svc=hq=":443"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="43,42,41,39,35", accept-ranges=none, connection=close
[2018-05-25T09:48:26.593Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/test-table
Fri May 25 2018 11:48:26 GMT+0200 (CEST)
[2018-05-25T09:48:27.222Z] <<< HTTP RESPONSE 200 server=nginx, date=Fri, 25 May 2018 09:48:27 GMT, content-type=application/json; charset=utf-8, content-length=141, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-05-25T09:48:27.223Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/test-table/tokens
Fri May 25 2018 11:48:27 GMT+0200 (CEST)
[2018-05-25T09:48:27.777Z] <<< HTTP RESPONSE 200 server=nginx, date=Fri, 25 May 2018 09:48:27 GMT, content-type=application/json; charset=utf-8, content-length=274, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
=== Deploying to 'test-table'...
i deploying hosting
i hosting: preparing dist directory for upload...
[2018-05-25T09:48:28.900Z] >>> HTTP REQUEST PUT https://deploy.firebase.com/v1/hosting/test-table/uploads/-LDLglCdzpfzQK77Fbrb?fileCount=2&message=
Fri May 25 2018 11:48:28 GMT+0200 (CEST)
Uploading: [ ] 0%[2018-05-25T09:48:32.752Z] <<< HTTP RESPONSE 200 server=nginx, date=Fri, 25 May 2018 09:48:32 GMT, content-type=application/json; charset=utf-8, content-length=49, connection=close, access-control-allow-origin=*, access-control-allow-methods=GET, PUT, POST, DELETE, OPTIONS, strict-transport-security=max-age=31556926; includeSubDomains; preload, x-content-type-options=nosniff
[2018-05-25T09:48:32.753Z] [hosting] .tgz uploaded successfully, waiting for extraction
✔ hosting: 2 files uploaded successfully
[2018-05-25T09:48:33.642Z] [hosting] deploy completed after 5190ms
[2018-05-25T09:48:33.643Z] >>> HTTP REQUEST POST https://deploy.firebase.com/v1/projects/test-table/releases
{ hosting:
{ public: 'dist',
ignore: [ 'firebase.json', '**/.*', '**/node_modules/**' ],
version: '-LDLglCdzpfzQK77Fbrb',
prefix: '-LDLglCdzpfzQK77Fbrb/',
manifest: [] } }
Fri May 25 2018 11:48:33 GMT+0200 (CEST)
[2018-05-25T09:48:34.951Z] <<< HTTP RESPONSE 200 server=nginx, date=Fri, 25 May 2018 09:48:34 GMT, content-type=application/json; charset=utf-8, content-length=34, connection=close, access-control-allow-origin=*, access-control-allow-methods=GET, PUT, POST, DELETE, OPTIONS, strict-transport-security=max-age=31556926; includeSubDomains; preload, x-content-type-options=nosniff
✔ Deploy complete!
The only information the Firebase CLI shows is:
i hosting: preparing dist directory for upload...
So this means that everything in your dist directory is deployed, and nothing else.
Since the files are uploaded as a single .tgz file, there is no progress report for individual files.

Wordpress emails going to spam

I have been having a lot of issues with emails from our servers going to SPAM. I cant find out why, I am not on any blacklist and we have the SPF/DKIM records validated.
Below is a transcripts of our emails...
Received: from host.ilovenz.me (host.ilovenz.me [96.30.1.56])
by relay-6.us-west-2.relay-prod (Postfix) with ESMTPS id 34DBA460BBA
for <20g0dnL7Le4vW8#dkimvalidator.com>; Sun, 26 Feb 2017 03:31:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilovenz.me;
s=default; h=MIME-Version:Content-Transfer-Encoding:Content-Type:Date:
Subject:To:Sender:From:Reply-To:Message-ID:Cc:Content-ID:Content-Description:
Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=dKce1b0OIqr1iFXsTI1PsQWwBft9eaJeSIwAbZhxRp0=; b=VOkfOW7ftU5bxGSL0Q9D+2tvB2
nGx9pmAcaRGzrFlwOLg8IrYYmU0h8PWqPTQ/4mD26BJCAEUdAYjXaKYl9ovhGWJMW9qAfK4Hy7JXk
aQDJOw6jBKHM5aRbgm9aIuXrPEe4+AngMao85vH9PKRTBQxegl2nJYX+JApr4MHf1S14uCyEYAcD7
nJwlrZJ32VAxn2gz1rDeevkTSptaSqpgX4EURzZDR/2osv53Np2//F+5qCTFabvwr9qe5RyiKsV5g
56TP/Ym1R4a25QzOg4yLiqr0ZlBh4zTB6lIGpfF7NWRtOPW49c02rEO8raOV3lgfXWWi+kD4NO1fy
Xw8Tljtw==;
Received: from host.ilovenz.me ([96.30.1.56]:48972 helo=localhost)
by host.ilovenz.me with esmtpa (Exim 4.88)
(envelope-from <hello#ilovenz.me>)
id 1chpYg-0000eR-6I
for 20g0dnL7Le4vW8#dkimvalidator.com; Sun, 26 Feb 2017 16:31:38 +1300
X-Mailer: Postman SMTP 1.7.2 for WordPress (https://wordpress.org/plugins/postman-smtp/)
From: ilovenz <hello#ilovenz.me>
Sender: hello#ilovenz.me
To: 20g0dnL7Le4vW8#dkimvalidator.com
Subject: [I Love New Zealand] Activate your account
Date: Sun, 26 Feb 2017 03:31:38 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
MIME-Version: 1.0
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - host.ilovenz.me
X-AntiAbuse: Original Domain - dkimvalidator.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - ilovenz.me
X-Get-Message-Sender-Via: host.ilovenz.me: authenticated_id: hello#ilovenz.me
X-Authenticated-Sender: host.ilovenz.me: hello#ilovenz.me
X-Source:
X-Source-Args:
X-Source-Dir:
Thanks for registering!=0A=0ATo complete the activation of your account,=
go to the following link: https://ilovenz.me/activate/kWwH8aMmTTYQCeii6=
nHDAZ1T3Lxw0QSr/
Probably because you are using an unusual TLD and you have the word 'love' in it. I had a similair problem with a poker site.

Automated emails from Woocommerce marked as spam. Wrong Return path

All the automated emails sent from woocommerce from my website are marked as spam. Here is the header:
Delivered-To: fontanavideostudios#gmail.com
Received: by 10.64.118.34 with SMTP id kj2csp1351282ieb;
Thu, 2 Apr 2015 05:19:26 -0700 (PDT)
X-Received: by 10.194.176.4 with SMTP id ce4mr94751409wjc.75.1427977166190;
Thu, 02 Apr 2015 05:19:26 -0700 (PDT)
Return-Path: <racebook>
Received: from ns362512.ip-91-121-174.eu ([2001:41d0:1:ef28::1])
by mx.google.com with ESMTP id e5si8490541wjw.70.2015.04.02.05.19.25
for <fontanavideostudios#gmail.com>;
Thu, 02 Apr 2015 05:19:26 -0700 (PDT)
Received-SPF: temperror (google.com: error in processing during lookup of racebook: DNS timeout) client-ip=2001:41d0:1:ef28::1;
Authentication-Results: mx.google.com;
spf=temperror (google.com: error in processing during lookup of racebook: DNS timeout) smtp.mail=racebook;
dkim=temperror (no key for signature) header.i=#
Received: by ns362512.ip-91-121-174.eu (Postfix, from userid 504)
id EA9BA1608B; Thu, 2 Apr 2015 14:16:42 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=racebooking.net;
s=default; t=1427977002;
bh=8Bpk5qKGS/snauZWTEWdgTP8RA8IIyUciiaTtpnN268=;
h=To:Subject:Date:From;
b=uPVvgt52HbS6VIzCMagUSpBDCvF787qIleF13Yw/7E95kuXdVJSdCo5IjbUTmGuBm
TUSe7jiDf4RfGzq2BQJUnFd91RljAVJHxWscY9U/ZFqGU65MjeIIfN7jLa+/k6Aj0/
m2bULvyRjwdU1EInjtl9y3SC593kACANJPR+u8/Y=
To: fontanavideostudios#gmail.com
Subject: Puoi scaricare i files accedendo a questa pagina: https://www.racebooking.net/foto-franciacorta/mio-account/
X-PHP-Originating-Script: 504:class-phpmailer.php
Date: Thu, 2 Apr 2015 12:16:42 +0000
From: Foto Franciacorta <noreply#racebooking.net>
Message-ID: <ddc1208f249c3ad34b96dad0437c49d8#www.racebooking.net>
X-Priority: 3
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
The cause is probably that the Return-Path is wrong. Instead of noreply#racebooking.net (correct) it is racebook, (incorrect). How can i fix it? I couldn't find any setting into Woocommerce options to fix the Return Path.
I fixed that by using this plugin which simply copies the "from" email into the Return Path

What PHP default_timezone_set based on?

I want to use the same time on master and slave.
I did that and has problem about date not return the same:
Server #1:
date_default_timezone_set('America/Los_Angeles');
date('r'); // => Thu, 17 Nov 2011 09:16:11 -0800
Server #2:
date_default_timezone_set('America/Los_Angeles');
date('r'); // => Thu, 17 Nov 2011 08:40:21 -0800
Server #3:
date_default_timezone_set('America/Los_Angeles');
date('r'); // => Thu, 17 Nov 2011 02:24:30 -0800
Any reason date('r') not return the same value on all server with same timezone set?
Thanks for your answer.
maybe the time is simple set wrong on the system. you could try to use a timeserver to fetch the date if you dont have enough rights.

Resources