When using Node 18 that doesn't contain the global crypto WebCrypto API, Framework 2.4.0 fails to be invoked with strictAuthentication: true during the HMAC validation.
[Error]: Unknown BridgeError: crypto is not defined
at bt.handleError (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:6281)
at bt.handleAction (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:4889)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:3618 {
data: {
stack: 'ReferenceError: crypto is not defined\n' +
' at Or (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:1:11777)\n' +
' at bt.validateHmac (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:6587)\n' +
' at bt.handleAction (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:4619)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
' at async /app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:3618'
},
statusCode: 500,
code: 'BridgeError'
}
π Reproduction steps
Install @novu/framework@2.4.0, serve a workflow with a Node 18 or less runtime.
Attempt to sync the Workflow with strictAuthentication: true
π Expected behavior
Sync should be successfull
π Actual Behavior with Screenshots
Sync fails with error:
[Error]: Unknown BridgeError: crypto is not defined
at bt.handleError (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:6281)
at bt.handleAction (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:4889)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:3618 {
data: {
stack: 'ReferenceError: crypto is not defined\n' +
' at Or (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:1:11777)\n' +
' at bt.validateHmac (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:6587)\n' +
' at bt.handleAction (/app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:4619)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
' at async /app/node_modules/@novu/framework/dist/cjs/servers/express.cjs:95:3618'
},
statusCode: 500,
code: 'BridgeError'
}
Novu version
Novu SaaS
npm version
No response
node version
18
π Provide any additional context for the Bug.
A polyfill for global crypto should be added in Node environments with version 18 or less.
π Have you spent some time to check if this bug has been raised before?
π Description
When using Node 18 that doesn't contain the global
crypto
WebCrypto API, Framework 2.4.0 fails to be invoked withstrictAuthentication: true
during the HMAC validation.π Reproduction steps
@novu/framework
@2.4.0, serve a workflow with a Node 18 or less runtime.strictAuthentication: true
π Expected behavior
Sync should be successfull
π Actual Behavior with Screenshots
Sync fails with error:
Novu version
Novu SaaS
npm version
No response
node version
18
π Provide any additional context for the Bug.
A polyfill for global
crypto
should be added in Node environments with version 18 or less.π Have you spent some time to check if this bug has been raised before?
π’ Have you read the Contributing Guidelines?
Are you willing to submit PR?
None