defender-autotask-examples
defender-autotask-examples copied to clipboard
Typescript example seems to have broken dependency
Hi,
I am trying to run the typescript example locally.
I cloned this repo. I added API keys and ran yarn install successfully. When I run yarn start, the script fails with this error:
TypeError: Cannot set property crypto of #<Object> which has only a getter
at Object.<anonymous> (/Users/r/projects/defender-autotask-examples/typescript/node_modules/defender-relay-client/src/api/auth.ts:5:14)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
at Object.require.extensions.<computed> [as .js] (/Users/r/projects/defender-autotask-examples/typescript/node_modules/ts-node/src/index.ts:1032:44)
at Module.load (node:internal/modules/cjs/loader:1068:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1092:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/Users/r/projects/defender-autotask-examples/typescript/node_modules/defender-relay-client/src/api/index.ts:1:1)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
Look like this line is failing.
I am running node v19.1.0, tsc Version 4.1.2, and yarn v1.22.10 on an Intel Mac.
I fixed this issue by applying this fix to the Defender Client.