nodejs-datastore
nodejs-datastore copied to clipboard
fix: check property existence for excludeFromIndexes with wildcard
Fixes https://github.com/googleapis/nodejs-datastore/issues/787 🦕
As described in https://github.com/googleapis/nodejs-datastore/issues/787, nodejs-datastore raises TypeError: Cannot read property 'entityValue' of undefined if we try to exclude undefined properties from index using .*.
This is because we didn't check the property existence (e.g. for non_exist_data.*, we should check non_exist_data's existence), so this PR make entity.ts check their existence before traversing data for excludeFromIndexes with a wildcard.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [x] Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
:memo: Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.
What to do if you already signed the CLA
Individual signers
- It's possible we don't have your GitHub username or you're using a different email address on your commit. Check your existing CLA data and verify that your email is set on your git commits.
Corporate signers
- Your company has a Point of Contact who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the Google project maintainer to go/cla#troubleshoot (Public version).
- The email used to register you as an authorized contributor must be the email used for the Git commit. Check your existing CLA data and verify that your email is set on your git commits.
- The email used to register you as an authorized contributor must also be attached to your GitHub account.
ℹ️ Googlers: Go here for more info.
Codecov Report
:exclamation: No coverage uploaded for pull request base (
main@a5cc245). Click here to learn what that means. The diff coverage isn/a.
:exclamation: Current head e408c19 differs from pull request most recent head 96a4c11. Consider uploading reports for the commit 96a4c11 to get more accurate results
@@ Coverage Diff @@
## main #788 +/- ##
=======================================
Coverage ? 98.97%
=======================================
Files ? 11
Lines ? 8260
Branches ? 486
=======================================
Hits ? 8175
Misses ? 83
Partials ? 2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
@googlebot I signed it!
@crwilcox or @stephenplusplus could I trouble y'all to have a look here?
No region tags are edited in this PR.
This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:
- [ ] Refresh this comment
Can someone please add this fix already? It is quite the detrimental bug.
It is a huge shame that this is still broken today in 7.0.0. In fact, two years ago my colleague posted about the same issue and the issue was closed with inaccurate information.
Closed in favour of https://github.com/googleapis/nodejs-datastore/pull/1114.