ews-javascript-api icon indicating copy to clipboard operation
ews-javascript-api copied to clipboard

nodejs 18: digital envelope routines::unsupported

Open nxps opened this issue 2 years ago • 4 comments
trafficstars

Node.js v18.16.0 ews-javascript-api v0.12.0 @ewsjs/xhr v1.5.0

(async () => {
  const xhr = new XhrApi().useNtlmAuthentication(credentials.userName, credentials.password);
  ews.ConfigurationApi.ConfigureXHR(xhr);
  
  const service = new ews.ExchangeService(ews.ExchangeVersion.Exchange2016);
  service.Credentials = new ews.WebCredentials(credentials.userName, credentials.password);
  service.Url = new ews.Uri(credentials.url);
  service.AcceptGzipEncoding = false;

  const emailMessage = new ews.EmailMessage(service);
  emailMessage.ToRecipients.Add(mail);
  emailMessage.Subject = 'Email sent with EWS API';

  const messageBody = new ews.MessageBody();
  messageBody.BodyType = ews.BodyType.HTML;
  messageBody.Text = 'Test email sent using EWS API';
  emailMessage.Body = messageBody;
  try {
    await emailMessage.SendAndSaveCopy();
    console.log('success');
  } catch (error) {
    console.log(error);
  }
})()

error log:

SoapFaultDetails {
  message: 'error:0308010C:digital envelope routines::unsupported',
  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
}

nxps avatar May 12 '23 10:05 nxps

see this - https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported

you may be able to use it with legacy ssl provider, I am not sure if i can fix the ntlm-client lib easily, any help is welcome

gautamsi avatar May 13 '23 21:05 gautamsi

Hi, I'm having trouble as well with ews and ntlm auth. I guess this is related, right? https://github.com/ewsjs/xhr/issues/13 https://github.com/ewsjs/ntlm-client/issues/2

tomer953 avatar May 15 '23 06:05 tomer953

Hello,

I have the same issue after upgrading my project to Node 18 (previously Node 16).

Using NODE_OPTIONS=--openssl-legacy-provider, as explained in the Stack Overflow page linked by @gautamsi, fixed my issue.

guicara avatar Aug 11 '23 10:08 guicara

Same here, I have to use Node 18+ for other packages, and I could see that creating a 'md4' hash triggers this error (even without ews-javascript-api). So any upgrade to git rid of this 'md4' hash in ews-javascript-api and ewsjs/whr will be more than welcome! Thank you, and thank you again for these great packages which help me a lot!

bfredo123 avatar Dec 10 '23 10:12 bfredo123

have updated to 0.14 which should fix this issue (ccd9d300fc6f5e27f81f5f42c9d8c901e82da0b5)

NODE_OPTIONS=--openssl-legacy-provider` should have been the workaround as I tested today.

gautamsi avatar Feb 25 '24 06:02 gautamsi