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

sp-rest-proxy does not work with Node 18.16.0 (current LTS) #163

Open
davea38 opened this issue Apr 14, 2023 · 5 comments
Open

sp-rest-proxy does not work with Node 18.16.0 (current LTS) #163

davea38 opened this issue Apr 14, 2023 · 5 comments

Comments

@davea38
Copy link

davea38 commented Apr 14, 2023

Hello again!

I've just updated my Windows 10 dev machine to Node 18.16.0 (current LTS) and sp-rest-proxy is throwing errors on all calls.

If I revert the Node version to v16.20.0 then the proxy starts working again with no code change.

My credential strategy is OnpremiseUserCredentials as I am using SP 2013 on-prem.

Error Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at Object.createNTLMHash (C:\...\node_modules\node-ntlm-client\lib\hash.js:77:22)
    at Object.createType3Message (C:\...\node_modules\node-ntlm-client\lib\ntlm.js:213:23)
    at C:\...\node_modules\node-sp-auth\lib\src\auth\resolvers\OnpremiseUserCredentials.js:41:35
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
@davea38
Copy link
Author

davea38 commented Apr 14, 2023

Found a workaround for using v18.16.0:

  • Install cross-env
npm i --save-dev cross-env
  • Alter the package.json script to add in this:
cross-env NODE_OPTIONS=--openssl-legacy-provider <proxyLaunch>

So for me the package.json line was:

{ "proxy": "cross-env NODE_OPTIONS=--openssl-legacy-provider node ./.sp-rest-proxy/server.js", }

Of course the other workaround is to revert to using v16.20.0 :)

@davea38
Copy link
Author

davea38 commented Apr 14, 2023

Found a workaround for using v18.16.0:

  • Install cross-env
npm i --save-dev cross-env
  • Alter the package.json script to add in this:
cross-env NODE_OPTIONS=--openssl-legacy-provider <proxyLaunch>

So for me the package.json line was:

{ "proxy": "cross-env NODE_OPTIONS=--openssl-legacy-provider node ./.sp-rest-proxy/server.js", }

Of course the other workaround is to revert to using v16.20.0 :)

Having said all of that using --openssl-legacy-provider still gives socket hang up errors, so the best solution is to revert node version to v16.

There error this time was:

Error FetchError: request to https://...admin/_api/web/lists/getByTitle(%27List%27)/items?$filter=OpportunityId_List%20eq%20%27222655,175452,213883,OP75509,194456,162443,OP74527,206207,162672,158434,173954,164109,175451,201289,173955%27 failed, reason: socket hang up
    at ClientRequest.<anonymous> (C:\...\node_modules\node-fetch\lib\index.js:1505:11)
    at ClientRequest.emit (node:events:513:28)
    at ClientRequest.emit (node:domain:489:12)
    at TLSSocket.socketOnEnd (node:_http_client:526:9)
    at TLSSocket.emit (node:events:525:35)
    at TLSSocket.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1359:12)

@davea38
Copy link
Author

davea38 commented May 3, 2023

Hi, @koltyakov I don't suppose you have an update for this please?

@kokoc58
Copy link

kokoc58 commented Mar 11, 2024

sp-rest-proxy does not work with Node 20
"Бен, это Данила айнидхелп...."

@koltyakov
Copy link
Owner

koltyakov commented Mar 11, 2024

@kokoc58 to run it with Node.js >= 18 you need to start in Node.js process with NODE_OPTIONS env variable with --openssl-legacy-provider.

npx cross-env NODE_OPTIONS=--openssl-legacy-provider ts-node ./src/server

image

image

Alternatively, we can contribute to node-sp-auth e.g. by replacing legacy NTLM client maybe with https://www.npmjs.com/package/@ewsjs/ntlm-client

What auth strategy do you use, Данила? :)

Does is work for you with NODE_OPTIONS=--openssl-legacy-provider? If not, what's the error?

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

3 participants