0

I'm trying to create a cloud function which includes certificate file in nodejs. Below is the code which I'm trying to execute:

 exports.invoke = async function(req, res) {

     const walletPath = path.join(process.cwd(), './wallet');
        const wallet = new FileSystemWallet(walletPath);
        console.log(`Wallet path: ${walletPath}`);

        // Check to see if we've already enrolled the user.
        const userExists = await wallet.exists('user1');
      console.log(userExists);
        if (!userExists) {
            console.log('An identity for the user "user1" does not exist in the wallet');
            console.log('Run the registerUser.js application before retrying');
            return;
        }
    }

Cloud function not able to read the certificate which is in the wallet folder.

Thanks in advance.

Harry
  • 1

1 Answers1

0

I would advise you to take a look at the public documentation where is an example of how to use files in your filesystem in Google Cloud functions.

In the example, you can see the recommended approach is to use the file system module as:

const fs = require('fs')

I also recommend you to take a look at this Stackoverflow answer [2] were more options to handle client certificates are discussed

Chris32
  • 130
  • 8