(node:8003) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'data' of undefined
See original GitHub issueCurrent Behavior
My app fails to start
Expected Behavior
My app should start
Steps to Reproduce
This is an interesting one. I tried using a new beta of Cloudinary Angular
"@cloudinary/angular": "1.0.0-beta.11",
"@cloudinary/url-gen": "^1.1.0",
I import CloudinaryModule into one of my libraries. This fails with the error below. However, it works fine if I use the older version of the beta:
"@cloudinary/angular": "1.0.0-beta.8",
"@cloudinary/base": "1.0.0-beta.4",
I’ve never gotten Nx to crash just because I upgraded a library.
Failure Logs
(node:8003) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'data' of undefined
at ProjectHasher.<anonymous> (/Users/crash/git/iko-travel-spa/node_modules/@nrwl/workspace/src/core/hasher/hasher.js:248:41)
at Generator.next (<anonymous>)
at /Users/crash/git/iko-travel-spa/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
at Object.__awaiter (/Users/crash/git/iko-travel-spa/node_modules/tslib/tslib.js:113:16)
at /Users/crash/git/iko-travel-spa/node_modules/@nrwl/workspace/src/core/hasher/hasher.js:241:79
at new Promise (<anonymous>)
at ProjectHasher.<anonymous> (/Users/crash/git/iko-travel-spa/node_modules/@nrwl/workspace/src/core/hasher/hasher.js:241:50)
at Generator.next (<anonymous>)
at /Users/crash/git/iko-travel-spa/node_modules/tslib/tslib.js:117:75
(node:8003) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8003) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Environment
Node : 12.22.6
OS : darwin x64
yarn : 1.22.15
nx : 12.10.0
@nrwl/angular : 12.10.0
@nrwl/cli : 12.10.0
@nrwl/cypress : 12.10.0
@nrwl/devkit : 12.10.0
@nrwl/eslint-plugin-nx : 12.10.0
@nrwl/express : Not Found
@nrwl/jest : 12.10.0
@nrwl/linter : 12.10.0
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 12.10.0
@nrwl/web : Not Found
@nrwl/workspace : 12.10.0
@nrwl/storybook : 12.10.0
@nrwl/gatsby : Not Found
typescript : 4.3.5
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (1 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'data' of undefined
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not...
Read more >'Cannot read property 'data' of undefined' nodeJS
I think the data field is undefined and hence the error. Try this, Client.getInfo(function(err, data) { if(err) return console.log("The ...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >How to Prevent the TypeError: Cannot Read Property Map of ...
A guide on the root cause of 'cannot read map of undefined' as well as techniques and tools to prevent this error.
Read more >Resolving the JavaScript Promise Error "TypeError: Cannot ...
TypeError : Cannot read property 'then' of undefined. ... This function is expected to return a Promise that should resolve to JSON data....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’ve got here with the same error after removing one npm package. The
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'data' of undefineddoesn’t really help to understand what is the issue 🙈I’ve figured out that it’s some nx cache and tried to find how to remove it. Advice from StackOverflow helped me with that:
rm -rf ./node_modules/.cache/nxTrashing my node_modules on a hunch fixed this issue for me just now.
Thanks @driver-by for showing me that I could have deleted just that one directory/file.