Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get SoapFaultDetails { message: 'read ECONNRESET', ..} on Jenkins #393

Open
lkasianenko opened this issue Dec 20, 2021 · 2 comments
Open

Comments

@lkasianenko
Copy link

Get this error on Jenkins but locally it works
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 }

My Code
`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 ----- ')
})

}`

@gautamsi
Copy link
Owner

is jenkins killing the connection prematurely ?

@lkasianenko
Copy link
Author

If you mean a connection with EWS, I don't know. Also, I added ews debug and got this error.

{ url: 'host', headers: { 'Content-Type': 'text/xml; charset=utf-8', Accept: 'text/xml', 'Accept-Encoding': 'gzip,deflate', Authorization: 'REDACTED' }, type: 'POST', data: '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"><soap:Header><t:RequestServerVersion Version="Exchange2013_SP1"></t:RequestServerVersion></soap:Header><soap:Body><m:FindItem Traversal="Shallow"><m:ItemShape><t:BaseShape>AllProperties</t:BaseShape></m:ItemShape><m:IndexedPageItemView MaxEntriesReturned="1" Offset="0" BasePoint="Beginning"></m:IndexedPageItemView><m:Restriction><t:Contains ContainmentMode="Substring" ContainmentComparison="IgnoreCase"><t:FieldURI FieldURI="item:Subject"></t:FieldURI><t:Constant Value="Lenovo Cloud Portal – New Account Details"></t:Constant></t:Contains></m:Restriction><m:ParentFolderIds><t:DistinguishedFolderId Id="inbox"></t:DistinguishedFolderId></m:ParentFolderIds></m:FindItem></soap:Body></soap:Envelope>'
Error in calling service, error code:undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants