© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
3 replies
ven

deno function - smtp - works locally but fails remote

Hello, I have a deno function triggering a SendGrid email that works locally but fails on remote. this is the log of the error
TimedOut: Connection timed out (os error 110)
    at async Object.connect (deno:ext/net/01_net.js:333:17)
    at async SmtpClient.connect (file:///src/main.ts:857:22)
    at async Server.<anonymous> (file:///src/main.ts:1173:5)
    at async Server.#respond (file:///src/main.ts:111:24)
Severity
ERROR
Deployment version3
Timestamp16 Oct, 2022 09:41
Execution ID43ccbd3e-63eb-43bb-9ab6-06f58bc38ea0
TimedOut: Connection timed out (os error 110)
    at async Object.connect (deno:ext/net/01_net.js:333:17)
    at async SmtpClient.connect (file:///src/main.ts:857:22)
    at async Server.<anonymous> (file:///src/main.ts:1173:5)
    at async Server.#respond (file:///src/main.ts:111:24)
Severity
ERROR
Deployment version3
Timestamp16 Oct, 2022 09:41
Execution ID43ccbd3e-63eb-43bb-9ab6-06f58bc38ea0


here is the key section of the function
    await smtp.connect({
        hostname: String(Deno.env.get('SENDGRID_SMTP_HOSTNAME')),
        port: Number(Deno.env.get('SENDGRID_SMTP_PORT')),
        username: String(Deno.env.get('SENDGRID_SMTP_USERNAME')),
        password: String(Deno.env.get('SENDGRID_SMTP_PASSWORD')),
    });

    try {
        await smtp.send({
            from: String(Deno.env.get('SENDGRID_SMTP_FROM')),
            to: payload.to,
            subject: payload.subject,
            content: payload.content,
        });
    } catch (error) {
        return new Response(error.message, { status: 500 });
    }

    await smtp.close();
    await smtp.connect({
        hostname: String(Deno.env.get('SENDGRID_SMTP_HOSTNAME')),
        port: Number(Deno.env.get('SENDGRID_SMTP_PORT')),
        username: String(Deno.env.get('SENDGRID_SMTP_USERNAME')),
        password: String(Deno.env.get('SENDGRID_SMTP_PASSWORD')),
    });

    try {
        await smtp.send({
            from: String(Deno.env.get('SENDGRID_SMTP_FROM')),
            to: payload.to,
            subject: payload.subject,
            content: payload.content,
        });
    } catch (error) {
        return new Response(error.message, { status: 500 });
    }

    await smtp.close();
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Remote to local dump fails
SupabaseSSupabase / help-and-questions
4y ago
Code that runs successfully locally fails when executed in an edge function
SupabaseSSupabase / help-and-questions
8mo ago
Cannot run function locally, possibly due to deno version or std version.
SupabaseSSupabase / help-and-questions
4y ago
smtp
SupabaseSSupabase / help-and-questions
5mo ago