- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的 React.js 项目中使用 nodemailer
和我的 Firebase 函数(服务器端函数)并且收到错误:错误:客户端网络套接字在安全 TLS 连接之前断开连接已建立...
并导致 一些 电子邮件无法发送出去。这对这个项目来说是一个大问题,因为客户端不能丢失从系统发送的电子邮件。为什么会出现此错误,我该如何解决?
Firebase 函数 index.js:
"use strict";
import functions = require('firebase-functions');
import admin = require("firebase-admin");
import nodemailer = require('nodemailer');
import { DocumentSnapshot } from 'firebase-functions/lib/providers/firestore';
import { Change, EventContext } from 'firebase-functions';
import { Status } from './common';
admin.initializeApp(functions.config().firebase);
export const onUserCreated = functions.firestore.document('users/{userId}')
.onCreate(async (snap: { data: () => any; }) => {
console.log("Client create heard! Starting inner...")
const newValue = snap.data();
try {
console.log("Started try{}...")
// Template it
const htmlEmail =
`
<div>
<h2>client Sign Up</h2>
`
// Config it
const transporter = nodemailer.createTransport({
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
user: functions.config().email.user,
pass: functions.config().email.password
}
})
console.log("transporter = " + transporter)
// Pack it
const mailOptions = {
from: `email123@gmail.com`,
to: 'email123@gmail.com',
replyTo: `${newValue.email}`,
subject: `user sign up`,
text: `A new user sign up with the email of ${newValue.email}.`,
html: htmlEmail
}
// Send it
transporter.sendMail(mailOptions, (err: any) => {
if(err) {
console.error(err);
} else {
console.log("Successfully sent mail with sendMail()!");
}
})
} catch (error) {
console.error(error)
}
});
函数包.json:
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "10"
},
"main": "lib/index.js",
"dependencies": {
"@types/nodemailer": "^6.4.0",
"firebase-admin": "^9.4.1",
"firebase-functions": "^3.11.0",
"nodemailer": "^6.4.16"
},
"devDependencies": {
"firebase-functions-test": "^0.2.3",
"tslint": "^5.12.0",
"typescript": "^3.8.0"
},
"private": true
}
最佳答案
在我的情况下,将 TLS 版本添加到 nodemailer
选项后错误消失了:
let transporter = nodemailer.createTransport({
host: 'smtp-server',
port: 25,
tls: {
ciphers : 'SSLv3',
},
});
关于javascript - Firebase功能上的"Error: Client network socket disconnected before secure TLS connection was established",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64885483/
我正在使用AWS中的VM设置Elasticsearch集群。 我知道每个节点都会自动尝试加入一个在同一网络中具有相同群集名称的现有群集。 但是,我无法理解“同一网络” 是什么。 为了了解同一网络,我发
我尝试部署一个已经存在于 Kovan 网络上的合约实例,以通过 web3 和 metamask 与其交互。 首先,我将 metamask 设置为我的当前提供者,然后我部署了一个合约实例,如下所示:
停止 docker 后,它拒绝重新启动。它提示另一个名为 docker0 的网桥已经存在: level=warning msg="devmapper: Base device already exis
我正在使用“docker network create --d bridge mynet”创建一个 docker 网络。我想获取与此 docker 网络关联的网桥名称。 我知道我可以使用“-o”来提供
我的一位同事的VPN连接有问题。似乎他的操作系统重设了代理设置,并且他需要手动将其更改回。有没有办法使用Powershell设置VPN和代理? 他正在使用Windows 7,因此可以使用Powersh
我在 Azure VM 中有一个虚拟机,我想获取网络输入/网络输出指标。 在 Azure 门户中,我将诊断设置和指标设置为存储到选定的存储表中。但存储的指标与我在 Azure 门户中看到的指标之间存在
我有一个用例,我的 Docker 容器的第二个接口(interface)需要共享主机的第二个网络接口(interface)的接口(interface)。这可能使用 docker network con
我在 Azure VM 中有一个虚拟机,我想获取网络输入/网络输出指标。 在 Azure 门户中,我将诊断设置和指标设置为存储到选定的存储表中。但存储的指标与我在 Azure 门户中看到的指标之间存在
我想了解一些关于 Docker 的事情: 如何找到我的容器所在的网络? 我可以动态分离我的容器并附加到其他网络吗?怎么样? 如果我有两个容器正在运行,如何检查这两个容器是否在同一个网络?我可以 pin
我已经开发了一款使用Reaction Native和世博会的应用程序,并想在它的末尾添加一个横幅广告。当我在Android模拟器上的开发版本上运行应用程序时,应用程序的其余部分在没有应用程序的情况下运
我已经编辑了 eth0,但我犯了一个错误,我的 VPS 现在处于脱机状态,甚至无法连接到 ssh,并在故障恢复控制台显示以下消息: “网络不可达”。 配置/编辑网络的命令是什么!? Photo 最佳答
今天早上我启动了我的 GCE 实例,并且 4/6 完全无法访问。所有这些都在同一个 us-east1-d 区域中。 SSH 连接也无法正常工作,因此我使用串行控制台连接到有问题的实例之一。 当我尝试
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 5年前关闭。 Improve this qu
我正在使用 Network.Browser 4000.0.9 检索网页: import Network.Browser import Network.HTTP main = do (uri
我正在尝试更新我在 docker 容器中的 apt 存储库,但我做不到。 docker run -it --dns 8.8.8.8 --dns 8.8.4.4 debian apt-get 更新 ..
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
Axios 是否可以区分以下内容: 由于客户端没有网络连接而失败的请求发出请求的时间 - (ERR_CONNECTION_REFUSED)。 由于网络连接丢失而失败的请求之后已发出请求,但在收到响应之
Unity 已升级其网络系统,并将旧网络称为遗留网络。 那么我们如何将 RPC 调用更改为新的 Unity Networking?这种方法的等价物是什么?我们应该为它编写自己的方法吗? (发送字节数组
在机器学习工具 vowpal wabbit ( https://github.com/JohnLangford/vowpal_wabbit/ ) 中,通常训练线性估计器 y*=wx。但是,可以添加前向
我正在尝试将 Boost 用于某些 IPv6 和多播网络通信。我需要构建一个使用特定网络接口(interface)索引的 IPv6 多播套接字。 我能够在 boost/asio/ip/detail/s
我是一名优秀的程序员,十分优秀!