D
Deno

help

Outgoing connection over TLS (port 465) from the deno deployment is failing

Bbegoon8/31/2023
I am trying to send an email via Gmail SMTP. The code is trying to connect to smtp.gmail.com on port 465. The connection fails with the error below. Locally, from my mac, the code works as expected. Is it the limitation of the edge platform? The error:
at async Object.connectTls (ext:deno_net/02_tls.js:36:51)
at async https://raw.githubusercontent.com/begoon/denomailer/main/client/basic/client.ts:25:16
at async SMTPClient.send (https://raw.githubusercontent.com/begoon/denomailer/main/client/basic/client.ts:57:5)
at async Module.send (file:///src/bot/emailer.ts:23:5)
at async file:///src/main.ts:232:5
at async dispatch (https://deno.land/x/oak@v12.6.0/middleware.ts:80:7)
at async dispatch (https://deno.land/x/oak@v12.6.0/middleware.ts:80:7)
at async dispatch (https://deno.land/x/oak@v12.6.0/middleware.ts:80:7)
at async Application.#handleRequest (https://deno.land/x/oak@v12.6.0/application.ts:470:9)
8/31/2023, 6:40:49 PM
gcp-europe-southwest1
response: { status: 404, type: undefined, hasBody: false, writable: true }
8/31/2023, 6:40:49 PM
gcp-europe-southwest1

[uncaught application error]: ConnectionRefused - Connection refused (os error 111)
at async Object.connectTls (ext:deno_net/02_tls.js:36:51)
at async https://raw.githubusercontent.com/begoon/denomailer/main/client/basic/client.ts:25:16
at async SMTPClient.send (https://raw.githubusercontent.com/begoon/denomailer/main/client/basic/client.ts:57:5)
at async Module.send (file:///src/bot/emailer.ts:23:5)
at async file:///src/main.ts:232:5
at async dispatch (https://deno.land/x/oak@v12.6.0/middleware.ts:80:7)
at async dispatch (https://deno.land/x/oak@v12.6.0/middleware.ts:80:7)
at async dispatch (https://deno.land/x/oak@v12.6.0/middleware.ts:80:7)
at async Application.#handleRequest (https://deno.land/x/oak@v12.6.0/application.ts:470:9)
8/31/2023, 6:40:49 PM
gcp-europe-southwest1
response: { status: 404, type: undefined, hasBody: false, writable: true }
8/31/2023, 6:40:49 PM
gcp-europe-southwest1

[uncaught application error]: ConnectionRefused - Connection refused (os error 111)
Kkeving8/31/2023
I don’t have a reference, but I believe email ports are specifically blocked outgoing from Deno deploy (if that’s what you’re using)
BBairdy8/31/2023
It is very likely Deno Deploy has implemented Spam Guard for folks with similar goals as yours. Also, Deno Mailer - GitHub Issue #72 describes the developer having issues implementing "STARTTLS is currently broken..." and recommends using version 1.4.0. Most recently version 1.6.0 - STARTTLS fix was released, that being 7 months ago.
Bbegoon9/1/2023
@suchislife801 I use 1.6.0. The code when running from my local development computer works normally. I even discovered the issue only when I deployed. In theory, the edge runtime, which Deno Deploy hosting implements, should not allow socket connectivity at all. Only fetch-based network calls are allowed in edge functions. But in this case the code should fail with a missing function error or something. But here the error seems to come from the OS network layer, when the socket connection had in fact been attempted. So far, I removed the email-sending part from my Deno Deploy deployment and instead created an endpoint at Vercel, which allows sending emails. That endpoint is in SvelteKit/TS, facilitating the "nodemailer" library. Now, my application at Deno Deploy calls that endpoint to send email instead of doing directly. I'm tempted to just go with Vercel for the whole app. Vercel is great. But I would like to stick to Deno Deploy for a while because Deno Deploy is also great 🙂
Mmo.hasan10/8/2023
TBH, i don't get this... okay my app needs to send emails to customers, so what should i do? switch my entire cloud to be able to send an email?
Llcasdev10/9/2023
You can use an email sender service like Postmark.
Mmo.hasan10/9/2023
@lucacasonato Thanks, i still rather not to pay for a service since i have it already working on my server. I'm moving to another cloud provider which is a shame because i really like Deno cloud! I would recommend looking into not blocking the ports by default for everyone, and instead have a better strategy that detects abuse in the run time and blocks the account if so.

Looking for more? Join the community!

Recommended Posts
setting module scope variable based on module import pathI have a big utilities file with many helper functions, mostly arround html parsing. Many of which tHow to import a npm package that relies on WasmI'm trying to import `npm:@biscuit-auth/biscuit-wasm@0.4.0` and I wrote the following script: ```TypDeno deploy --allow-write permission.I'm writing a small web app that uses tilia (https://deno.land/x/tilia@0.1.2) to manage a small jsonGetting values from Deno KV in a Web Worker always return empty array despite working correctly o...Getting values from Deno KV in a Web Worker always return empty array despite working correctly outsSimple Deno program on Windows quits after 20 secondsHi I have created a simple deno program and now compiled to an exe file for window using the commanNeed some help for Deno/FreshJS projectI have a Deno/FreshJS project and need some help from someone with extensive experience in Deno/FresI need more help understanding imports and relative paths for a module I am writingI am diving into the world of Deno and I am trying to port an existing node CLI. _If you are develIs there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anot...Is there an idiomatic/common/modern way of creating a queue of jobs to be executed one after anotherLaunch tests with unstable flag inside VS CodeHi there, I'm creating a module that uses FFI and Deno.dlopen and I wrote tests to validate some of What is the difference between JS Map and JS Object?I know that `Map` is hash table implementation for JS, but how does it differ from an object? With rDeno KV: Should I expect 'value too large' errors inserting a JSON file with kv.set?I was trying out kv and quickly ran into something I found surprising; ```js let kv = await Deno.oDeno language server stops working in VS CodeAfter some random time the language server stops working and I suddenly get code errors like this: `Getting free disk space without using child_process.Hello everyone! I would like to create a small CLI tool using Typescript and Deno. I would like to mtest --filter a stepCan I only run a certain step in the test?fastwebsockets how to end client calls and avoid Error in websocket connection Unexpected EOFWhat is the issue in this client code that causes the error? ```rust pub async fn connect() -> Resuldeno compile --include argumentIn `deno compile`, how can i include a whole directory instead of just a file? Also, is there a way `deno run` as a library`deno run` does a lot of useful things behind the scenes, many of which are not exposed as a libraryPermissions with npm/node importsI'm trying to run a command and it's like I need to add `--allow-read` permissions because of the `nBroadcastChannelWhen using BroadcastChannel api, in the background does deno send the broadcast to every instance orIs it possible to create a TCP server on Deno Deploy?Is it possible to create a TCP server on Deno Deploy?