Function timeout when outbound DNS & SMTP

I’m trying to write a function that will send a DNS query and then an SMTP request.
I get a timeout, are those outbound ports closed? is it possible to DNS query and create SMTP conenctions out?

Netlify is not blocking any ports as of now. If you’re getting a timeout, I’d assume it’s because your task is not finishing within the 10 sec limit.

@agam Welcome to the Netlify community. As there is no server running – only a CDN – it depends on how you are trying to do the queries. It should be possible with something like DNS-JS, but not with the command line.

Got it, so native nodejs libraries won’t work?

They will for building the site, but once your site is built the server passes all files to the CDN. Once that happens, there is no server running.

I’m trying to run it as a function as an API route in nextjs, is that still the case? @gregraven

If it requires a server, then yes. If you can do it in HTML, CSS, and JavaScript – or using an external API – then it should work.

What severless platform do you recommend? (I don’t like the big players because they can’t limit my usage).

All this while I thought you were using Netlify Functions. If you were not, would you try using that. SMTP seems to work with Netlify Function using Nodemailer.

I did all that I wrote in netlify functions… (via next.js api routes) or does it not do that?

@agam If the problem is because serverless system don’t allow OS commands, I would think that any serverless system would be the same.

@gregraven aws lambda does work no?

I’m proud to say that I have no idea.

hey @Agam, it seems like what you are asking for goes a bit beyond what we can provide support for in these forums. That said, if you figure it out, please do let us know!