TypeError: Cannot read property 'unwrapObject' of undefined
See original GitHub issueIt appears with the new version, 30 (I guess starting from 27). It depends on the doc returned, if it contains array of maps or other particular nested structure, it crashes. With a “standard” doc, so without nested object, it works. Works fine until version 26.
Minimal code to reproduce the problem
const firestore = FirestoreApp.getFirestore(email, key, projectId);
firestore.query('carts').orderBy('lastUpdate', 'desc').limit(10000).execute();
Expected Behavior
documents[0].obj; // This returns raw object.
Actual Results
documents[0].obj;
// TypeError: Cannot read property 'unwrapObject' of undefined
// at unwrapValue(Document:62:29)
// at unwrapArray(Document:79:29)
// at unwrapValue(Document:64:29)
// at [unknown function](Document:74:31)
// at unwrapObject(Document:73:49)
// at get obj(Document:42:25)
Library Version:
30
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
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 >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >Uncaught typeError: Cannot read property of undefined - object
I've looked at other questions w/ this error message the issue usually seems to be that javascript hasn't defined the variable yet. I...
Read more >How to Prevent the Error: Cannot Read Property '0' of Undefined
A guide on how to prevent the error "cannot Read Property '0' of Undefined", covering techniques such as try, catch, using const over...
Read more >How to Fix TypeError: Cannot read Property 'push' of ...
You call the method on a variable previously set to undefined . You call the method on a variable before it has been...
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

@marcolong I see the issue. I misunderstood the problem. I got thrown off because you were using the
.queryfunctionality. But it was all about unwrapping a nested object. I’ll work on this.As stated in the Breaking Changes:
This change was to avoid conflicts with Firestore Typing documentation.