I am trying to make a simple subscription run on AWS amplify's appsync.
the subscription never fires and after about 30sec I get this error message when waiting for the sub in the appsync console:
Error: {
"errors": [
{
"message": "Connection failed: Connection handshake error"
}
]
}
at Object.error (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:859689)
at d (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:203:1070669)
at m (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:203:1071013)
at e.value (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:203:1072095)
at n.<anonymous> (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:679765)
at r (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:675841)
at Object.throw (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:675176)
at s (https://d3owqdqy53mge.cloudfront.net/4e0034b0d516077971e58313cecbbabc76608841/main.js:135:674969)
If I recreate the call from my browser I get this error:
WebSocket connection to 'wss://r23irwx4tndnjdfh7tlethffca.appsync-realtime-api.us-east-2.amazonaws.com/graphql?header=eyJBdXRob3JpemF0aW9uIjoiZXlKcmFXUWlPaUpTYWx3dlVEVkxOV2N5ZUd0blVXRXhWa3g2YmxVd1YwTmxZbnBsVFdsek4zZHpjelZ0Ym5SYVZrMVpUVDBpTENKaGJHY2lPaUpTVXpJMU5pSjkuZXlKemRXSWlPaUl3WldVNFlUZzVNUzB6TnpFeUxUUXhNekV0T1RsalpTMDFNelZrTTJVeE5UQmpaR0VpTENKbGRtVnVkRjlwWkNJNklqTXpZV1E0T1RneUxXUTBaalV0TkRCa09TMWlaRFl3TFdFNFpEWXlOelprTVRFellTSXNJblJ2YTJWdVgzVnpaU0k2SW1GalkyVnpjeUlzSW5OamIzQmxJam9pWVhkekxtTnZaMjVwZEc4dWMybG5ibWx1TG5WelpYSXVZV1...VSDNCYnJURTM5YmVWNEEzdW1JdGdPN0RjOVFCVkI2U09uX1ZJdVFvUElIOUZGNk10QzdtWTJLby0wQ19NTF9tSVAxdEFTVkNzSW5Zbjd4MWZzalFoUFpaS1J6MTFKbHJPdE5rOWNzOXVrd29yMU1iRGlBNklIOEJiaXIzSjNRNDlSckhXODZLM3RhQmNGSlphQVpnTEhKS05QajlBWWZhVHRNTnZnVmV4UUJhZzQ2cW5VZ3l1amF0SUMwamZ1Mk9LUUh1d2NNaGt6WjJjYlB6aWNwcG5kVk5aVVdnY1hzUlBadndFTzlENnZmZ3UyZTM0eHZXRW9mZld1RGh4LVc5Ui1HSEktbG1YTU4ydk9xd1RURTRxejdNM2Q3WGJvN3VyWUpsSHlGUUIxQSIsImhvc3QiOiJyMjNpcnd4NHRuZG5qZGZoN3RsZXRoZmZjYS5hcHBzeW5jLWFwaS51cy1lYXN0LTIuYW1hem9uYXdzLmNvbSJ9&payload=e30=' failed: Error during WebSocket handshake: net::ERR_SSL_PROTOCOL_ERROR
The only solution I found to this was to change my router...
Have no idea why it makes a difference, tried all the router setting I could think of
I used my home LTE WiFi router and kept getting this error, eventually changed to a local sim card-based router from my cell provider and it connected every time.
I have used this on many different models and works every time. The router which was failing was a Huawei B525 router, any other router doesn't give the issues...
Related
Intermittently getting the following error when connecting to an AWS keyspace using a lambda layer
All host(s) tried for query failed. First host tried, 3.248.244.53:9142: Host considered as DOWN. See innerErrors.
I am trying to query a table in a keyspace using a nodejs lambda function as follows:
import cassandra from 'cassandra-driver';
import fs from 'fs';
export default class AmazonKeyspace {
tpmsClient = null;
constructor () {
let auth = new cassandra.auth.PlainTextAuthProvider('cass-user-at-xxxxxxxxxx', 'zzzzzzzzz');
let sslOptions1 = {
ca: [ fs.readFileSync('/opt/utils/AmazonRootCA1.pem', 'utf-8')],
host: 'cassandra.eu-west-1.amazonaws.com',
rejectUnauthorized: true
};
this.tpmsClient = new cassandra.Client({
contactPoints: ['cassandra.eu-west-1.amazonaws.com'],
localDataCenter: 'eu-west-1',
authProvider: auth,
sslOptions: sslOptions1,
keyspace: 'tpms',
protocolOptions: { port: 9142 }
});
}
getOrganisation = async (orgKey) => {
const SQL = 'select * FROM organisation where organisation_id=?;';
return new Promise((resolve, reject) => {
this.tpmsClient.execute(SQL, [orgKey], {prepare: true}, (err, result) => {
if (!err?.message) resolve(result.rows);
else reject(err.message);
});
});
};
}
I am basically following this recommended AWS documentation.
https://docs.aws.amazon.com/keyspaces/latest/devguide/using_nodejs_driver.html
It seems that around 10-20% of the time the lambda function (cassandra driver) cannot connect to the endpoint.
I am pretty familiar with Cassandra (I already use a 6 node cluster that I manage) and don't have any issues with that.
Could this be a timeout or do I need more contact points?
Followed the recommended guides. Checked from the AWS console for any errors but none shown.
UPDATE:
Update to the above question....
I am occasionally (1 in 50 if I parallel call the function (5 concurrent calls)) getting the below error:
"All host(s) tried for query failed. First host tried,
3.248.244.5:9142: DriverError: Socket was closed at Connection.clearAndInvokePending
(/opt/node_modules/cassandra-driver/lib/connection.js:265:15) at
Connection.close
(/opt/node_modules/cassandra-driver/lib/connection.js:618:8) at
TLSSocket.
(/opt/node_modules/cassandra-driver/lib/connection.js:93:10) at
TLSSocket.emit (node:events:525:35)\n at node:net:313:12\n at
TCP.done (node:_tls_wrap:587:7) { info: 'Cassandra Driver Error',
isSocketError: true, coordinator: '3.248.244.5:9142'}
This exception may be caused by throttling in the keyspaces side, resulting the Driver Error that you are seeing sporadically.
I would suggest taking a look over this repo which should help you to put measures in place to either prevent the occurrence of this issue or at least reveal the true cause of the exception.
Some of the errors you see in the logs you will need to investigate Amazon CloudWatch metrics to see if you have throttling or system errors. I've built this AWS CloudFormation template to deploy a CloudWatch dashboard with all the appropriate metrics. This will provide better observability for your application.
A System Error indicates an event that must be resolved by AWS and often part of normal operations. Activities such as timeouts, server faults, or scaling activity could result in server errors. A User error indicates an event that can often be resolved by the user such as invalid query or exceeding a capacity quota. Amazon Keyspaces passes the System Error back as a Cassandra ServerError. In most cases this a transient error, in which case you can retry your request until it succeeds. Using the Cassandra driver’s default retry policy customers can also experience NoHostAvailableException or AllNodesFailedException or messages like yours "All host(s) tried for query failed". This is a client side exception that is thrown once all host in the load balancing policy’s query plan have attempted the request.
Take a look at this retry policy for NodeJs which should help resolve your "All hosts failed" exception or pass back the original exception.
The retry policies in the Cassandra drivers are pretty crude and will not be able to do more sophisticated things like circuit breaker patters. You may want to eventually use a "failfast" retry policy for the driver and handle the exceptions in your application code.
I search everywhere on internet but could not any tutorial regarding this, How can I connect I connect to AWS RDS database and RDS replica in laravel 8 and also want to know configurations.
.env file
DB_CONNECTION=mysql
DB_HOST=********.********.us-east-1.rds.amazonaws.com
DB_PORT=3306
DB_DATABASE=********
DB_USERNAME=********
DB_PASSWORD=********
got these error
SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
(SQL: select * from information_schema.tables where table_schema = ******* and table_name = migrations and table_type = 'BASE TABLE')
at C:\Users\DELL\kenduit\vendor\laravel\framework\src\Illuminate\Database\Connection.php:712
708▕ // If an exception occurs when attempting to run a query, we'll format the error
709▕ // message to include the bindings with SQL, which will make this exception a
710▕ // lot more helpful to the developer instead of just the database's errors.
711▕ catch (Exception $e) {
➜ 712▕ throw new QueryException(
713▕ $query, $this->prepareBindings($bindings), $e
714▕ );
715▕ }
716▕ }
1 C:\Users\DELL\kenduit\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::("SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
")
2 C:\Users\DELL\kenduit\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct("mysql:host=*******.czdmmigxjpgh.us-east-1.rds.amazonaws.com;port=3306;dbname=********", "******", "******", [])
I'm working with WSO2 APIM 3.1.0 and some of my endpoints are getting constantly in SUSPENDED state.
The endpoint was built to return http code 400, 403, 404 as part of its business logic.
In the Advanced Configurations for a given endpoint, we might set the Error Code to move the endpoint into suspension or timeout state.
The error codes below are available for selection:
101000 Receiver input/output error sending
101001 Receiver input/output error receiving
101500 Sender input/output error sending
101501 Sender input/output error receiving
101503 Connection failed
101504 Connection timed out (no input was detected on this connection over the maximum period of inactivity)
101505 Connection closed
101506 NHTTP protocol violation
101507 Connection canceled
101508 Request to establish new connection timed out
101509 Send abort
101510 Response processing failed
Http codes, such as 400/403/404, returned by the endpoint are mapped to some of those WSO2 error codes ?
Yes, If you set suspension code, it will be internally mapped with the response code.
I'm attempting to connect a Loopback app to a Google SQL database, and I've altered the Datasource.json file to match the credentials. However, when I make a GET request in the Loopback API explorer I get an error. I have not found any docs on how to specify the ssl credentials in Datasource.json and I think this is causing the error.
I've fruitlessly attempted to change Datasource.json and below is the current state. I've changed details for privacy, but I'm 100% certain the credentials are correct as I can make a successful connection with javascript.
{
"nameOfModel": {
"name": "db",
"connector": "mysql",
"host": "xx.xxx.x.xxx",
"port": xxxx,
"user": "user",
"password": "password",
"database": "sql_db",
"ssl": true,
"ca" : "/server-ca.pem",
"cert" : "/client-cert.pem",
"key" : "/client-key.pem"
}
}
This is the error the command line returns when I attempt a GET request on the loopback API explorer. The "Error:
Timeout in connecting after 5000 ms" leads me to believe it's not reading the ssl credentials.
Unhandled error in GET /edd-sales?filter[offset]=0&filter[limit]=0&filter[skip]=0: 500 TypeError: Cannot read property 'name' of undefined
at EddDbDataSource.DataSource.queueInvocation.DataSource.ready (D:\WebstormProjects\EDD-Database\edd-api\node_modules\loopback-datasource-juggler\lib\datasource.js:2577:81)
(node:10176) UnhandledPromiseRejectionWarning: Error: Timeout in connecting after 5000 ms
at Timeout._onTimeout (D:\WebstormProjects\EDD-Database\edd-api\node_modules\loopback-datasource-juggler\lib\datasource.js:2572:10)
at ontimeout (timers.js:498:11)
(node:10176) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:10176) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Are you sure datasource.json allows you to specify "ssl" connections? Where did you get that information? I have checked their documentation and they don't show the "ssl" properties that you are using. Neither it specifies so on the MySQL connector properties.
You have two options:
1.- Create the connection without using SSL.
2.- Create your own connector or use an existing one with ssl options implemented. Have in mind that this might causes issues with LoopBack framework.
Don't matter which of the two options you decide to use, remember to Whitelist your IP (the IP from where you are trying to access the database instance), you can do so on the Cloud Console, on the "Connections" tab, under "public IP" Authorized networks. If you don't do this it can cause the timeout error that you are getting.
Try this. I am using lookback3 and it works well for me. You need to create datasources.local.js in order to properly load CA files.
datasources.local.js
const fs = require('fs');
module.exports = {
nameOfModel: {
name: 'db',
connector: 'mysql',
host: 'xx.xxx.x.xxx',
port: 'xxxx',
user: 'user',
password: 'password',
database: 'sql_db',
ssl: {
ca: fs.readFileSync(`${__dirname}/server-ca.pem`),
cert: fs.readFileSync(`${__dirname}/client-cert.pem`),
key: fs.readFileSync(`${__dirname}/client-key.pem`),
},
}
}
Notice that instead of using ssl: true, you need to use an object with those properties.
I'm trying to get stats for my celery Que (rabbitmq). I'm using celery.app.control.Inspect().stats() API. I'm doing this on a web server, I can get the stats only one time. If I refresh the page I'm getting "[Errno 104] Connection reset by peer" Error. how can I deal with this.
/init.py
celtasks = Celery(app.name,"rabbit mq url")
/helpers.py
get_stats():
stats = celtasks.control.Inspect().stats()
return stats
whenever there is a request "get_stats" function is hit. It is only working for the first request after this, it says connection reset by peer error.
If I go by connection has been reset and try to create the connection again, I get error
updated /helpers.py
get_stats():
celtasks = Celery(app.name,"rabbit mq url")
stats = celtasks.control.Inspect().stats()
return stats
Rabbitmq logs
=WARNING REPORT==== 10-Jul-2017::14:11:54 ===
closing AMQP connection <0.29185.6> (10.246.170.70:48618 -> 10.24.83.115:5672):
connection_closed_abruptly
=WARNING REPORT==== 10-Jul-2017::14:11:54 ===
closing AMQP connection <0.29197.6> (10.246.170.70:48620 -> 10.24.83.115:5672):
connection_closed_abruptly
"rabbit#oser000300.log-20170625" 9054L, 361662C
AT most times , CONNECTION RESET BY PEER is because the server close the connection itself, however the client does not know . When client want to communicate to sever through this broke connection, it receive this ERROR. In your case , maybe the hang time (time interval between two stats()) is too long, and server think this connection is useless and close it .