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

🐛 Bug Report: Node <=18 - Unknown BridgeError: crypto is not defined #6982

Open
2 tasks done
rifont opened this issue Nov 13, 2024 · 1 comment
Open
2 tasks done
Assignees

Comments

@rifont
Copy link
Collaborator

rifont commented Nov 13, 2024

📜 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]: 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

  1. Install @novu/framework@2.4.0, serve a workflow with a Node 18 or less runtime.
  2. 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?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to submit PR?

None

Copy link

linear bot commented Nov 13, 2024

@rifont rifont changed the title 🐛 Bug Report: Unknown BridgeError: crypto is not defined 🐛 Bug Report: Node <18 - Unknown BridgeError: crypto is not defined Nov 13, 2024
@rifont rifont changed the title 🐛 Bug Report: Node <18 - Unknown BridgeError: crypto is not defined 🐛 Bug Report: Node <=18 - Unknown BridgeError: crypto is not defined Nov 13, 2024
@rifont rifont self-assigned this Nov 13, 2024
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

1 participant