apache / apache/pouchdb

function getFieldFromDoc(doc, parsedField) doc is undefined => Server crashed

Open
#8,558 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17.6k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

### Issue
Server is crashing randomly with this exeption:
projectpath\node_modules\pouchdb-selector-core\lib\index.js:17
value = value[key];
_______________^
TypeError: Cannot read properties of undefined (reading 'name')
at getFieldFromDoc (projectpath\node_modules\pouchdb-selector-core\lib\index.js:17:18)
### Info
- Environment: Node.js
- Frontend build with Angular Material
- Platform: Chrome
- Adapter: LevelDB (not shure)
- Server: Web server with Node.js

### Reproduce
Not reproducible, but I fixed it in my project by checking the doc value and returning immediately if doc is undefined

![Screenshot (3)](https://user-images.githubusercontent.com/73761358/205018436-442bdd6c-a0b6-40b5-bac9-93ebd1c4fc0d.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.