googleapis-common throwing error in UUID dependency

Viewed 337

I'm trying to get a very basic oauth example to work in a node.js app with express and googleapis. Upon running the application it throws a TypeError inside the UUID dependency which is included with the googleapis-common module. I'm getting a bit frustrated at this point because I have not been able to find any additional information about this to allow me to resolve it myself.

Take a look at the screenshot below for the specifics: Stack trace from vs code

Here it is in text if that makes things easier:

Exception has occurred: TypeError: Cannot assign to read only property 'name' of function 'function generateUUID(value, namespace, buf, offset) {
    if (typeof value === 'string') {
      value = strin...<omitted>... }'
  at _default (C:\Users\ficar\OneDrive\Desktop\Frontend\node_modules\googleapis-common\node_modules\uuid\dist\v35.js:71:23)
    at Object.<anonymous> (C:\Users\ficar\OneDrive\Desktop\Frontend\node_modules\googleapis-common\node_modules\uuid\dist\v3.js:14:27)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\ficar\OneDrive\Desktop\Frontend\node_modules\googleapis-common\node_modules\uuid\dist\index.js:63:34)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)

The file this is being thrown in is called "v35.js".

My initial thought is that I must be missing some additional library that interprets the logic throwing the error differently. Eager to learn more about this and find a resolution.

1 Answers

Looks like this is how the uuid module works node_modules/uuid/dist/v35.js

function _default(name, version, hashfunc) {
  function generateUUID(value, namespace, buf, offset) {
    ...
  } // Function#name is not settable on some platforms (#270)

  try {
    generateUUID.name = name; // eslint-disable-next-line no-empty
  } catch (err) {} // For CommonJS default export support
  ...

Authors warn (comment on line 4), that name property may not be settable and bypass it with empty catch

Related