error "could not load the shared library" api google vms

4k views Asked by At

I'm doing integration with the google api to manage the vms, the code used:

const {google} = require('googleapis');
const compute = google.compute('v1');
    async function listVMs() {
            const authClient = await google.auth.getClient({
              scopes: [
                'https://www.googleapis.com/auth/cloud-platform',
                'https://www.googleapis.com/auth/compute',
                'https://www.googleapis.com/auth/compute.readonly',
              ],
            });
          
            const projectId = await google.auth.getProjectId();
            const result = await compute.instances.aggregatedList({
              auth: authClient,
              project: projectId,
            });
            const vms = result.data;
            console.log('VMs:', vms);
          }
          listVMs();

error I'm getting:

node:internal/crypto/sig:131 const ret = this[kHandle].sign(data, format, type, passphrase, rsaPadding, ^

Error: error:25078067:DSO support routines:win32_load:could not load the shared library at Sign.sign (node:internal/crypto/sig:131:29) at Object.sign (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\jwa\index.js:152:45) at Object.jwsSign [as sign] (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\jws\lib\sign-stream.js:32:24) at GoogleToken.requestToken (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\gtoken\build\src\index.js:225:31) at GoogleToken.getTokenAsyncInner (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\gtoken\build\src\index.js:163:21) at GoogleToken.getTokenAsync (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\gtoken\build\src\index.js:142:55) at GoogleToken.getToken (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\gtoken\build\src\index.js:94:21) at JWT.refreshTokenNoCache (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\google-auth-library\build\src\auth\jwtclient.js:171:36) at JWT.refreshToken (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\google-auth-library\build\src\auth\oauth2client.js:152:24) at JWT.getRequestMetadataAsync (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\google-auth-library\build\src\auth\oauth2client.js:284:28) { opensslErrorStack: [ 'error:0E076071:configuration file routines:module_run:unknown module name', 'error:0E07506E:configuration file routines:module_load_dso:error loading dso', 'error:25070067:DSO support routines:DSO_load:could not load the shared library' ], library: 'DSO support routines', function: 'win32_load', reason: 'could not load the shared library', code: 'ERR_OSSL_DSO_COULD_NOT_LOAD_THE_SHARED_LIBRARY' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

2

There are 2 answers

0
Elia Weiss On

In my case, the issue is related to the internal nodejs crypto package on the new Ubuntu 22.04 LTS version.

I found the following solution: get the location of openssl.cnf file: openssl version -d

comment out the lines providers = provider_sectin in the file openssl.cnf and restart application

1
Maurício Spagnol On

the solution is to add a certificate to the project to run as https: