TLS Error with Interfax via Netlify Functions in Production Only

Faxes send perfectly in development mode using netlify-lambda.

I get a TLS error in production only.

Delivery Error { Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1137:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at TLSSocket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
code: ‘ECONNRESET’,
path: null,
host: ‘rest.interfax.net’,
port: 443,
localAddress: undefined }

I got this message from an interfax employee regarding the issue:

Hello Sean,

Based upon the error, it seems to be related to the TLS and the possibly the cipher’s attempting to be used by your application. For a list of cipher’s our endpoint supports, please reference the image below and/or the following link: https://www.ssllabs.com/ssltest/analyze.html?d=rest.interfax.net&latest

Thank you,

Anthony Cox
Technical Support Engineer, Client Services

  • your netlify istance name, for example: app-typescript.netlify.com

Hi @seanaguinaga , which version of node are you using locally? Can you try with node 10 and see if you have the same trouble? You can find more information on changing the node version for your function in https://docs.netlify.com/functions/build-with-javascript/#runtime-settings

I am running Node 12.13.0.

I switched to Node 10 and it still worked locally.

I changed NODE_VERSION to 12 in Netlify and it still fails with the same error.

What’s the library that you’re using? Can you share your repo or is it private? @seanaguinaga

My Repo:

https://github.com/preconceptioncode/app-ts

Library:

function endpoint to hit:

XYZ … /.netlify/functions/lab-result-send-fax

Our staff cannot see into your repo (only our build network can), just for future reference, Sean.

The only run of that function which I can see (by path) in the last week was on your “app” site, and returned a 200 OK which I guess means that things worked?

I don’t see any other initiations on our CDN in the past 30 days at that path, so maybe we never even called the function, or you have it running under a different name, or something?

https://github.com/preconceptioncode/app-ts

Should be public

after signing in to

(https://app.preconceptiontest.com/)

with

email/username:

netlify@test.com

password:

12345678

Hit the endpoint multiple times:

/.netlify/functions/lab-result-send-fax

It will eventually give you the TLSSocket Delivery error.

Please ignore my sloppy http status codes! lol

3:49:37 PM: lab-result-send-fax invoked

3:49:37 PM: 2019-11-18T23:47:08.302Z c278d190-2e56-4124-81e0-525f24955e36 Created File File {
_documents:
Documents {
_client:
Client {
_https: [Object],
_credentials: [Object],
_version: ‘0.8.1’,
_debug: false } },
ready: true,
_callbacks: ,
_chunkSize: 1048576,
header: ‘Content-Type: application/pdf’,
body: <Buffer 25 50 44 46 2d 31 2e 34 0a 31 20 30 20 6f 62 6a 0a 3c 3c 0a 2f 54 69 74 6c 65 20 28 fe ff 29 0a 2f 43 72 65 61 74 6f 72 20 28 fe ff 00 77 00 6b 00 68 … > }

3:49:37 PM: Delivery Error { Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1137:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at TLSSocket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
code: ‘ECONNRESET’,
path: null,
host: ‘rest.interfax.net’,
port: 443,
localAddress: undefined }

3:49:37 PM: Delivery Error { Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1137:19)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at TLSSocket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
code: ‘ECONNRESET’,
path: null,
host: ‘rest.interfax.net’,
port: 443,
localAddress: undefined }

3:49:37 PM: Buffer <Buffer 25 50 44 46 2d 31 2e 34 0a 31 20 30 20 6f 62 6a 0a 3c 3c 0a 2f 54 69 74 6c 65 20 28 fe ff 29 0a 2f 43 72 65 61 74 6f 72 20 28 fe ff 00 77 00 6b 00 68 … >

3:49:37 PM: Data undefined

Like I said before, this works fine locally and used to work fine in production! Alas, not anymore.

From Interfax:

Anthony Cox (Upland Success)

Nov 12, 17:27 UTC

Hello Sean,

Based upon the error, it seems to be related to the TLS and the possibly the cipher’s attempting to be used by your application. For a list of cipher’s our endpoint supports, please reference the image below and/or the following link: https://www.ssllabs.com/ssltest/analyze.html?d=rest.interfax.net&latest

Thank you,

Anthony Cox
Technical Support Engineer, Client Services

[interfaxus-support@uplandsoftware.com]

and image:

inline-962237337.png\ 543x334

Checked those logs and it looks like it worked for you guys!

Did you do anything or did it just work for you!?

We didn’t do anything differently. Just triggered the function from our end.

One thing to try would be setting your function to use Node12 by setting a runtime variable, specifically the AWS_LAMBDA_JS_RUNTIME variable should be set to nodejs12.x. Note that this variable is different from NODE_VERSION which sets the Node version for the buildbot only.