Basic part of sample doesn't work. With clean setup, cannot edit a beer. Solution included.
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript, node.js
Research direction
Inspect beer_app.js at done_edit_beer around line 163, then reproduce the edit-and-save flow in a clean setup. Confirm that saving an edited beer completes without the reported ReferenceError and that the edit is persisted after restarting the server.
Written by the indexing model from the issue text.
Description
If you click on [Edit] for any beer, and edit any field and then press [Save Changes], the following error is printed to the browser:
ReferenceError: rc is not defined
at done_edit_beer (c:\git\5\beersample-node\beer_app.js:163:13)
at callbacks (c:\git\5\beersample-node\node_modules\express\lib\router\index.js:164:37)
at param (c:\git\5\beersample-node\node_modules\express\lib\router\index.js:138:11)
at param (c:\git\5\beersample-node\node_modules\express\lib\router\index.js:135:11)
at pass (c:\git\5\beersample-node\node_modules\express\lib\router\index.js:145:5)
at Router._dispatch (c:\git\5\beersample-node\node_modules\express\lib\router\index.js:173:5)
at Object.router (c:\git\5\beersample-node\node_modules\express\lib\router\index.js:33:10)
at next (c:\git\5\beersample-node\node_modules\express\node_modules\connect\lib\proto.js:190:15)
at Object.staticMiddleware [as handle] (c:\git\5\beersample-node\node_modules\express\node_modules\connect\lib\middleware\static.js:55:61)
at next (c:\git\5\beersample-node\node_modules\express\node_modules\connect\lib\proto.js:190:15)
Solution
It seems that rc. was erroneously added to the front of rc.doc.brewery_id on line 163 of beer_app.js. Remove the text rc., save the file, and restart the server and the edit feature now works.
db.get( rc.doc.brewery_id, function(err, result) {
becomes
db.get( doc.brewery_id, function(err, result) {
Editing should now work.
Note: I'm really surprised this hasn't been noticed for nearly a year now. Is nobody learning to use Couchbase on Node.js?
Note #2: I really wish there were more sample applications for Node.js, more full-fledged examples that show best practices of using Node.js and of using Couchbase. Samples with production-ready error handling, and samples that are perhaps designed to demonstrate the scalability of couchbase as part of the application (like perhaps some data-processing on statistics or something involving alot of data crunching, maybe GeoSpatial). Perhaps someone could suggest some solid open source projects which do this, for me to look over?
- Dominant language
- JavaScript
- Stars
- 8
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from couchbaselabs/beersample-node
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
All issues in couchbaselabs/beersample-node
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·