EWS 在 Jenkins 上因“读取 ECONNRESET”而失败
Posted
技术标签:
【中文标题】EWS 在 Jenkins 上因“读取 ECONNRESET”而失败【英文标题】:EWS fails with 'read ECONNRESET' on Jenkins 【发布时间】:2022-01-22 00:16:45 【问题描述】:使用这些库连接到 ews 并获取电子邮件:
“ews-javascript-api”:“^0.10.3” “ews-javascript-api-auth”:“^1.2.1”在本地它可以工作,我可以连接到邮箱,但是当我在 Jenkins 上运行它时,我收到了这个错误:
SoapFaultDetails
message: 'read ECONNRESET',
InnerException: null,
faultCode: null,
faultString: null,
faultActor: null,
responseCode: 127,
errorCode: 0,
exceptionType: null,
lineNumber: 0,
positionWithinLine: 0,
errorDetails: DictionaryWithStringKey
keys: [],
keysToObjs: ,
objects: ,
keyPicker: [Function (anonymous)]
,
HttpStatusCode: undefined
连接和阅读电子邮件的功能:
function getEws(user, password, host, subject)
ews.ConfigurationApi.ConfigureXHR(new ewsAuth.ntlmAuthXhrApi(user, password))
const service = new ews.ExchangeService(ews.ExchangeVersion.Exchange2013_SP1)
service.Credentials = new ews.WebCredentials(user, password)
service.Url = new ews.Uri(host)
service
.SubscribeToStreamingNotifications(
[new ews.FolderId(ews.WellKnownFolderName.Inbox)],
ews.EventType.NewMail,
ews.EventType.Created,
ews.EventType.Deleted,
ews.EventType.Modified,
ews.EventType.Moved,
ews.EventType.Copied,
ews.EventType.FreeBusyChanged
)
.then(function (streamingSubscription)
var connection = new ews.StreamingSubscriptionConnection(service, 1)
connection.AddSubscription(streamingSubscription)
connection.OnNotificationEvent.push(function (obj)
ews.EwsLogging.Log(obj, true, true)
const searchFilter = new ews.SearchFilter.SearchFilterCollection(ews.LogicalOperator.And, [
new ews.SearchFilter.ContainsSubstring(ews.ItemSchema.Subject, subject)
])
const itemview = new ews.ItemView(1)
const foundItems = service.FindItems(ews.WellKnownFolderName.Inbox, searchFilter, itemview)
const adinationalProps = []
adinationalProps.push(ews.ItemSchema.TextBody)
foundItems.then(function (response)
for (const item of response.Items)
item
.Load(new ews.PropertySet(ews.BasePropertySet.FirstClassProperties, adinationalProps))
.then(function ()
fs.writeFileSync('cypress/fixtures/email.txt', item.TextBody.text)
)
.catch(error =>
console.log(' ----- Load error start ----- ')
console.error(error)
console.log(' ----- Load error end ----- ')
)
)
)
connection.OnDisconnect.push(function (connection, subscriptionErrorEventArgsInstance)
ews.EwsLogging.Log(subscriptionErrorEventArgsInstance, true, true)
)
connection.Open()
)
.catch(error =>
console.log(' ----- SubscribeToStreamingNotifications error start ----- ')
console.error(error)
console.log(' ----- SubscribeToStreamingNotifications error end ----- ')
)
如果有任何关于如何在 Jenkins 上解决此问题的想法,我将不胜感激。
【问题讨论】:
【参考方案1】:这是 Travis 方面过期 SSL 证书的问题。
【讨论】:
以上是关于EWS 在 Jenkins 上因“读取 ECONNRESET”而失败的主要内容,如果未能解决你的问题,请参考以下文章
React Native saveToCameraRoll 在 Android 上因“权限被拒绝”错误而失败
sigsegv 在 iPhone 上因 crittercism 崩溃
opencv make 在 Ubuntu 上因 CUDA 支持而失败
shutil.rmtree 在 Windows 上因“访问被拒绝”而失败 [重复]