N
Novu3w ago
loup

Error trying to sync to cloud (code based workflow)

Ive made an ExpressJS api and ive setup an endpoint /novu. Ive publish my app on subdomain.mydomain.com but when I try to sync manually with subdomain.mydomain.com/novu my logs :
[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'
}
[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'
}
12 Replies
Pawan Jain
Pawan Jain3w ago
@loup Can you share @novu/framework version?
loup
loupOP3w ago
Im using this one "@novu/framework": "^2.4.0",
Richard Fontein
Thanks @loup , could you please also share which Node version you are using?
loup
loupOP3w ago
v23.1.0 Wait its my local version I should test on my VPS
Richard Fontein
Yes, the deployed Bridge Node version will be great thanks. I suspect we may need to add a polyfill for crypto in older Node versions.
loup
loupOP3w ago
node -v v18.20.2 Im using Coolify btw for hosting my express api (idk if it change something)
Richard Fontein
Got it, thanks. The crypto global is only available with Node 20+, are you able to upgrade your Node version to solve in the meantime? We will look at adding a polyfill for older versions
loup
loupOP3w ago
okay I need to make a custom Dockerfile (I was using nixpack), Im gonna check that thx a lot !
Richard Fontein
Perfect! As a heads up, Node 18 reaches end of life on 30 April 2025, so it's generally a good idea to update.
Richard Fontein
I have raised an issue that we'll address in the next week or so.
GitHub
🐛 Bug Report: Node <18 - `Unknown BridgeError: crypto is not define...
📜 Description 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]: U...
loup
loupOP3w ago
its working with node 22. Im facing to another issue :
{
"statusCode": 400,
"timestamp": "2024-11-13T10:22:17.860Z",
"path": "/v1/bridge/sync?source=studio",
"message": "Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.",
"error": "Bad Request"
}
{
"statusCode": 400,
"timestamp": "2024-11-13T10:22:17.860Z",
"path": "/v1/bridge/sync?source=studio",
"message": "Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.",
"error": "Bad Request"
}
I was thinkg novu framework automatically handle the signature header, docs :
The Novu-Signature header included in each signed event contains a timestamp and one or more signatures that we verify. The timestamp is prefixed by t=, and each signature is prefixed by a scheme. Schemes start with v, followed by an integer. Currently, the only valid live signature scheme is v1.

Handling the signature verification is done by the Novu Framework, so you don’t need to perform any action.
The Novu-Signature header included in each signed event contains a timestamp and one or more signatures that we verify. The timestamp is prefixed by t=, and each signature is prefixed by a scheme. Schemes start with v, followed by an integer. Currently, the only valid live signature scheme is v1.

Handling the signature verification is done by the Novu Framework, so you don’t need to perform any action.
Dima Grossman
Dima Grossman3w ago
@loup are you using the EU or US cloud deployment of novu? Also, please verify that you have a proper NOVU_SECRET_KEY defined in your environment
Want results from more Discord servers?
Add your server