sudden yesod tls exception, DecodeError - haskell

I've suddenly started encountering the following errors when attempting to use gmail authentication (Yesod.Auth.GoogleEmail2) in my Yesod Application:
FailedConnectionException2 "www.googleapis.com" 443 True sendBuf: resource vanished (Broken pipe)
and
TlsExceptionHostPort (HandshakeFailed (Error_Packet_unexpected "Alert [(AlertLevel_Fatal,DecodeError)]" " expected: change cipher")) "www.googleapis.com" 443
The second error is more common. It's still possible to log in---reloading after the error gives
StatusCodeException (Status {statusCode = 400, statusMessage = "Bad Request"}) [("Content-Type","application/json; charset=utf-8"),("Cache-Control","no-cache, no-store, max-age=0, must-revalidate"),("Pragma","no-cache"),("Expires","Mon, 01 Jan 1990 00:00:00 GMT"),("Date","Wed, 24 Aug 2016 01:13:02 GMT"),("Content-Encoding","gzip"),("X-Content-Type-Options","nosniff"),("X-Frame-Options","SAMEORIGIN"),("X-XSS-Protection","1; mode=block"),("Server","GSE"),("Alternate-Protocol","443:quic"),("Alt-Svc","quic=\":443\"; ma=2592000; v=\"35,34,33,32,31,30\""),("Transfer-Encoding","chunked"),("X-Response-Body-Start","{\n \"error\" : \"invalid_grant\",\n \"error_description\" : \"Code was already redeemed.\"\n}"),("X-Request-URL","POST https://accounts.google.com:443/o/oauth2/token")] (CJ {expose = []})
and heading back through the auth route after getting that message logs you in.
I'm building on the Yesod scaffolded site, and as far as I can tell, nothing has changed in Foundation.hs or Application.hs since before this problem started showing up. The application is being deployed with keter, and compiled in stack lts-6.12
twofold question: what's the cause, and what's the fix?

I had bump up to lts-6.28 to get it work.

Related

Receiving "EPROTO" when HTTPS requests with Node 10

a few days ago i moved my frontend with NextJS to Vercel and i started experiencing this following intermittent error during build and production server. So i searched all over the internet but i cannot find the solution.
I am receiving the following error when my App tries to make HTTPS request:
Compiled successfully.
09:47:13.026 Automatically optimizing pages...
09:47:15.212 Error at BlogService.getRecentPosts, details: Error: request to https://**masked** failed, reason: write EPROTO 140256911292224:error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1550:SSL alert number 80
09:47:16.629 Error at getStaticProps on Homepage, details: Error: write EPROTO 140657767638848:error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1550:SSL alert number 80
09:47:16.654 Error at BlogService.getRecentPosts, details: Error: request to https:/**masked** failed, reason: write EPROTO 139955108906816:error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1550:SSL alert number 80
The backend destination is using a Nginx with Reverse Proxy with LetsEncrypt Certificate
So anybody can help me? I never experienced this issue
UPDATE
I changed my backend to AWS Api Gateway but the issue remains.
I already changed my frontend to just make Https requests using TLS 1.2, and the error remains intermittent
Anybody help me?

Firebase Functions - https onRequest "HTTP Error: 400, The request has errors"

I'm having some major issues with my firebase functions. I'm trying to create an https request so that I can send data to Firebase.
I have a super simple code just to test, and it's causing errors:
Here is my code (there should be no problem with this code):
exports.fetchPosts = functions.https.onRequest((req, res) => {
console.log(req)
res.send("Hello!")
})
my index.ts file is 700 lines long.. without fetchPosts it deploys perfectly fine.. with fetchPosts I get these errors..
Here is the error:
! functions: failed to create function fetchPosts
HTTP Error: 400, The request has errors
and here is the verbose error message:
[2019-06-22T16:09:13.362Z] <<< HTTP RESPONSE 400 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Sat, 22 Jun 2019 16:09:11 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, connection=close
[2019-06-22T16:09:13.362Z] <<< HTTP RESPONSE BODY code=400, message=The request has errors, status=INVALID_ARGUMENT, details=[#type=type.googleapis.com/google.rpc.BadRequest, fieldViolations=[field=runtime, description=Runtime field cannot be empty.]]
! functions: failed to create function fetchPosts
HTTP Error: 400, The request has errors
Any ideas what the issue might be? This seems ridiculous, as the code literally should work.
Managed to fix this issue after weeks!! What finally worked for me:
npm i -g firebase-tools#latest
Deleted package-lock.json file
Deleted node_modules folder
npm install
firebase deploy
Hope that can help someone in the same position!!

500 Internal Server Error due to deleted .htaccess file

My apologies if this question seems noob-ish. It will be a great help if anyone can solve my problem.
I have hosted a site on mochahost and while using an ftp client, .htaccess file accidentally got deleted. Now when I try to use the Contact Form, it gives the following error, this was working when the .htaccess file was there:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#hostedsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
This is the Error Log I found using cPanel:
[Fri Feb 23 03:03:11 2018] [error] [client 45.115.84.90] File does not exist: /home/user/public_html/404.shtml, referer: http://hostedsite.com/index.php
[Fri Feb 23 03:03:11 2018] [error] [client 45.115.84.90] File does not exist: /home/user/public_html/favicon.ico, referer: http://hostedsite.com/index.php
[Fri Feb 23 03:03:10 2018] [error] [client 45.115.84.90] File does not exist: /home/user/public_html/500.shtml, referer: http://hostedsite.com/
Update:
Mochahost support asked me to use Pear Mail client, and I've also found this Error in the log of public_html directory:
[23-Feb-2018 05:01:22 America/Chicago] PHP Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /home/user/php/Net/SMTP.php on line 465
You have to contact Mochahost support team , letting them know this issue and ask them if they can recover the .htaccess file from the backup.
Turned out that I was severely misguided by the mochahost support when the told me that I MUST use pear mail, otherwise mail won't go through. Then they refused to help me that this is custom code so they can't do anything and that too was the same code they referred to, here is the link: Send Email from a PHP Script Using SMTP Authentication(PEAR)
I asked a seasoned developer and he told me that the problem was in fact in the pear, not the htaccess file. Also, the simple php mail() is enough for this specific scenario and it's working now.
Support means support, mochahost support should investigate the issue first without just ditching the customer almost immediately.

500 internal server error on gitlab

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#gitlab.dev.sample.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.0-fips DAV/2 Phusion_Passenger/4.0.42 mod_bwlimited/1.4 mod_fcgid/2.3.9 Server at gitlab.dev.sample.com Port 80

Nginx sends status 200 after PHP parse error

I've configured nginx with php-fpm on Ubuntu (and everything works pretty well).
One thing I encountered is that HTTP status code 200 is sent, when a PHP parse error occurs. The error log contains the following entry:
[error] 3205#0: *2854 FastCGI sent in stderr: "PHP Parse error: syntax error, unexpected T_REQUIRE_ONCE in /var/www/.../index.php on line 32" while reading response header from upstream, client: 1.2.3.4, server: example.com; request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "example.com"
I was not able to figure out, why not a code 50x is sent. I have not configured any error_page settings and I read the documentation of error_page. I also tried it to set the status code (with error_page 500 =500 /50x.html and so on). But always status 200 is returned.
I can send status headers from PHP (header('HTTP/1.1 404 Not Found')), this works. However, for errors issued by the PHP interpreter (also uncaught exceptions), the server's response doesn't take into account that an error occurred.
FYI, this is now fixed in Xdebug (2.2) for PHP 5.4 and up. Sadly, it needed a change in PHP to make it work that could not be back-ported to 5.3.

Resources