cy.task() with require('oracledb') throwing error

Viewed 763

Installed: "cypress": "^4.10.0" "oracledb": "^5.0.0"

Node Oracle Client v5

$ node -v v12.18.2

I'm getting the following error when I require node-oracle in cypress: not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

Anyone overcome this already?

Test code:

describe('DB Registration', () => {
    it.only('Register a new user', () => {
        cy.task('registration', emailAddress)
    })
})

plugins/index.js code

module.exports = (on, config) => {
  on('task', {
      'registration': () => {

    const oracledb = require('oracledb');
    try {
      oracledb.initOracleClient({libDir: './instantclient_19_3'});
      
      console.log("IM INSIDE")

        let result;
        let connection;

        try {
            connection = oracledb.getConnection(  {
            user          : process.env.ORACLEDB_USER,
            password      : process.env.ORACLEDB_PASSWORD,
            connectString : "localhost/abc"
            });

enter image description here

1 Answers

I got past this error by running sudo spctl --master-disable on the node oracle instantclient_19_3 folder. Source.

Then in cypress.json i set "nodeVersion": "system" Source.

Related