Websocket failing connection with phoenix - phoenix-framework

App.js:7 WebSocket connection to 'ws://localhost:4000/socket/websocket?token=undefined&vsn=2.0.0' failed:
And then in the logs
Transport: :websocket
Serializer: Phoenix.Socket.V2.JSONSerializer
Parameters: %{"token" => "SFMyNTY.g2gDYQFuBgBoR0bYggFiAAFRgA._1bc8_ag00XMoZ1WXaqBcIvnaq5muBMW2AUSQ7Avoy0", "vsn" => "2.0.0"}
[info] REFUSED CONNECTION TO RotbWeb.UserSocket in 30µs
Transport: :websocket
Serializer: Phoenix.Socket.V2.JSONSerializer
Parameters: %{"token" => "undefined", "vsn" => "2.0.0"}
[info] REFUSED CONNECTION TO RotbWeb.UserSocket in 35µs
Transport: :websocket
Serializer: Phoenix.Socket.V2.JSONSerializer
Parameters: %{"token" => "undefined", "vsn" => "2.0.0"}
[info] REFUSED CONNECTION TO RotbWeb.UserSocket in 104µs
These errors used to be intermittent and I just wait and it resolves itself but it appears it is no longer resolving itself.

Related

Rabbit mq 2.1.3 version

I am getting below error while consuming message on rabbit mq through fanout approach :
2022-08-24 12:53:29.559 ERROR 42 --- [2.20.43.29:5672] o.s.a.r.c.CachingConnectionFactory : Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'avitas.nodedata' in vhost 'avitas': received 'topic' but current is 'fanout', class-id=40, method-id=10)

Sending Email with Laravel swiftmailer (Connection could not be established)

When trying to send email using laravel swiftmailer & using smtp.gmail.com my php.ini ssl connection is open already but still get these errors
my .env file code
MAIL_DRIVER=mail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=dg.shahneel21321#gmail.com
MAIL_PASSWORD=example123
MAIL_ENCRYPTION=tsl
Error # 1 (when using MAIL_ENCRYPTION=tsl)
Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to tsl://smtp.gmail.com:587 (Unable to find the socket transport "tsl" - did you forget to enable it when you configured PHP?)
Error # 2 (when using MAIL_ENCRYPTION=ssl)
Connection could not be established with host smtp.gmail.com :stream_socket_client(): SSL: An existing connection was forcibly closed by the remote host.
I also tried already give solution on stackoverflow
add this to mail.php
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],
also adding the following lines to _establishSocketConnection() in
$options['ssl']['verify_peer'] = FALSE;
$options['ssl']['verify_peer_name'] = FALSE;
Please help!! Thanks in advance

AWS Lambda function for oracle password rotation

Hi I am using lambda function for oracle password rotation and am getting the below error once every grants provided:
START RequestId: f515ffc3-56d4-4301-96a5-426ab14c68a2 Version: $LATEST
[INFO] 2020-05-14T13:54:14.9Z f515ffc3-56d4-4301-96a5-426ab14c68a2 {'RequestType': 'Create', 'ServiceToken': 'arn:aws:lambda:eu-west-1:661211433270:function:oracle-rds-dbsetup-lambda', 'ResponseURL': 'https://cloudformation-custom-resource-response-euwest1.s3-eu-west-1.amazonaws.com/arn%3Aaws%3Acloudformation%3Aeu-west-1%3A661211433270%3Astack/oracle/24520dd0-95e8-11ea-b1d1-0609694b6370%7CRDSDBSetup%7Cff43fa14-be13-4a66-95e5-ee0b82a44993?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20200514T135412Z&X-Amz-SignedHeaders=host&X-Amz-Expires=7200&X-Amz-Credential=AKIAJ7MCS7PVEUOADEEA%2F20200514%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=20bb8ba39f88fb14efb623b9047e89a628eb9c881c67b4d035995d9859918bb9', 'StackId': 'arn:aws:cloudformation:eu-west-1:661211433270:stack/oracle/24520dd0-95e8-11ea-b1d1-0609694b6370', 'RequestId': 'ff43fa14-be13-4a66-95e5-ee0b82a44993', 'LogicalResourceId': 'RDSDBSetup', 'ResourceType': 'Custom::DBSetup', 'ResourceProperties': {'ServiceToken': 'arn:aws:lambda:eu-west-1:661211433270:function:oracle-rds-dbsetup-lambda', 'MasterSecretArn': 'arn:aws:secretsmanager:eu-west-1:661211433270:secret:rds/app/master4-h4UyCN', 'AppUserGrants': ['CREATE SESSION', 'CONNECT', 'RESOURCE', 'DBA'], 'AppSecretArn': 'arn:aws:secretsmanager:eu-west-1:661211433270:secret:rds/app/application4-3XnzKs'}}
[INFO] 2020-05-14T13:54:14.50Z f515ffc3-56d4-4301-96a5-426ab14c68a2 Found credentials in environment variables.
[INFO] 2020-05-14T13:54:15.455Z f515ffc3-56d4-4301-96a5-426ab14c68a2 User created: testappdbuser
[INFO] 2020-05-14T13:54:15.459Z f515ffc3-56d4-4301-96a5-426ab14c68a2 Granted: CREATE SESSION
[INFO] 2020-05-14T13:54:15.470Z f515ffc3-56d4-4301-96a5-426ab14c68a2 Granted: CONNECT
[INFO] 2020-05-14T13:54:15.475Z f515ffc3-56d4-4301-96a5-426ab14c68a2 Granted: RESOURCE
[INFO] 2020-05-14T13:54:15.479Z f515ffc3-56d4-4301-96a5-426ab14c68a2 Granted: DBA
[INFO] 2020-05-14T13:54:15.480Z f515ffc3-56d4-4301-96a5-426ab14c68a2 Successfully created user testappdbuser in Oracle Server DB for secret arn arn:aws:secretsmanager:eu-west-1:661211433270:secret:rds/app/application4-3XnzKs.
https://cloudformation-custom-resource-response-euwest1.s3-eu-west-1.amazonaws.com/arn%3Aaws%3Acloudformation%3Aeu-west-1%3A661211433270%3Astack/oracle/24520dd0-95e8-11ea-b1d1-0609694b6370%7CRDSDBSetup%7Cff43fa14-be13-4a66-95e5-ee0b82a44993?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20200514T135412Z&X-Amz-SignedHeaders=host&X-Amz-Expires=7200&X-Amz-Credential=AKIAJ7MCS7PVEUOADEEA%2F20200514%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=20bb8ba39f88fb14efb623b9047e89a628eb9c881c67b4d035995d9859918bb9
Response body:
{
"Status": "SUCCESS",
"Reason": "See the details in CloudWatch Log Stream: 2020/05/14/[$LATEST]c85275eb57604aebb929853d877306c7",
"PhysicalResourceId": "2020/05/14/[$LATEST]c85275eb57604aebb929853d877306c7",
"StackId": "arn:aws:cloudformation:eu-west-1:661211433270:stack/oracle/24520dd0-95e8-11ea-b1d1-0609694b6370",
"RequestId": "ff43fa14-be13-4a66-95e5-ee0b82a44993",
"LogicalResourceId": "RDSDBSetup",
"NoEcho": false,
"Data": {}
}
send(..) failed executing requests.put(..): HTTPSConnectionPool(host='cloudformation-custom-resource-response-euwest1.s3-eu-west-1.amazonaws.com', port=443): Max retries exceeded with url: /arn%3Aaws%3Acloudformation%3Aeu-west-1%3A661211433270%3Astack/oracle/24520dd0-95e8-11ea-b1d1-0609694b6370%7CRDSDBSetup%7Cff43fa14-be13-4a66-95e5-ee0b82a44993?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20200514T135412Z&X-Amz-SignedHeaders=host&X-Amz-Expires=7200&X-Amz-Credential=AKIAJ7MCS7PVEUOADEEA%2F20200514%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-**Signature=20bb8ba39f88fb14efb623b9047e89a628eb9c881c67b4d035995d9859918bb9 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fec35bc8610>: Failed to establish a new connection: [Errno 110] Connection timed out'))**
END RequestId: f515ffc3-56d4-4301-96a5-426ab14c68a2
Is your Lambda function in a VPC without a NAT gateway? Looks like it doesn't have an outbound internet connection since it doesn't have an IP address.
Try removing the Lambda from the VPC if you don't need to access VPC private resources.
Otherwise, it also looks like you need to access RDS from within the Lambda, so in that case, you should add a NAT gateway to your VPC.
Some useful resources:
AWS Lambda: How to setup a NAT gateway for a lambda function with VPC access
https://aws.amazon.com/premiumsupport/knowledge-center/internet-access-lambda-function/

How to use connection string with sequel for postgresql

I wanted to connect to postgresql database using connection string in form of
host=localhost user=x password=y dbname=z
this works fine when passed to psql
$ psql "host=localhost user=x password=y dbname=z"
and when passed to the PG gem
> PG.connect("host=localhost user=x password=y dbname=z")
however it fails when I try to pass it into sequel
> Sequel.postgres(constr)
Sequel::DatabaseConnectionError: PG::ConnectionBad: could not connect to server: No such file or directory
How can I make sequel connect to my database?
You could use a string with the connection information, for example:
conn_str = 'postgres://localhost/database_name?user=user&password=password'
DB = Sequel.connect(conn_str)
Check the Sequel's documentation of how to open connections with a hash
DB = Sequel.connect(
adapter: 'postgres',
host: 'localhost',
database: 'database_name',
user: 'database_user',
password: 'password'
)
Then you should be able to run:
DB[:table_name].where(:attribute => 5000..10000)
Or you could use the postgres method directly:
DB = Sequel.postgres('my_db', :user => 'user', :password => 'password', :host => 'localhost')
Check devhints open connection shortcuts

yandex smtp doesnt work on codeigniter(digitalocean+ubuntu+serverpilot)

I send email on localhost but doesnt work same settings on server(digitalocean+serverpilot).
php's open ssl support is enabled.
php get "Message: fsockopen(): unable to connect to
ssl://smtp.yandex.com.tr:465 (Connection timed out)
codeigniter framework get :
The following SMTP error was encountered: 110 Connection timed out
Unable to send email using PHP SMTP. Your server might not be
configured to send mail using this method.
my code is:
$config = Array('protocol' => 'smtp','smtp_host' => 'ssl://smtp.yandex.com.tr','smtp_port' => 465, 'smtp_user' => 'info#mydomain.com','smtp_pass' => 'mypass','mailtype' => 'html', 'charset' => 'utf-8');
$this->load->library('email');
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from('info#mydomain.com', 'test.com');
$this->email->to('testing#yandex.com');
$this->email->subject('test');
$this->email->message('test body');
$this->email->send();
echo $this->email->print_debugger();
nslookup smtp.yandex.com:
Server: 2001:4860:4860::8844 Address: 2001:4860:4860::8844#53
Non-authoritative answer: smtp.yandex.com canonical name =
smtp.yandex.ru. Name: smtp.yandex.ru Address: 93.158.134.38
Name: smtp.yandex.ru Address: 87.250.250.38 Name: smtp.yandex.ru
Address: 213.180.204.38 Name: smtp.yandex.ru Address: 213.180.193.38
Name: smtp.yandex.ru Address: 77.88.21.38
and telnet request is work.
Your outgoing connection may be blocked by a firewall.
Use tool like tcptraceroute to locate the problem.

Resources