Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"nosql": "^3.0.3" has a bug #26

Closed
kanian opened this issue Oct 22, 2019 · 4 comments
Closed

"nosql": "^3.0.3" has a bug #26

kanian opened this issue Oct 22, 2019 · 4 comments

Comments

@kanian
Copy link

kanian commented Oct 22, 2019

To anybody going through the exercises after node v10.0.0,

nosql v3.0.3, used in the code exercises, has a bug in FileReader.prototype.open in index.js line 2388. The callback in fs signature is no longer optional since v7.0.0 and throws an error since node v10.0.0
However, newer versions of nosql, have a different API than the one used in the exercises code. A quick fix, just to follow the exercises: in the node_modules/nosql/index.js, at line 2388, change
fs.close(fd); to
fs.close(fd, err=>{console.log(err)});

Cheers

@amchavan
Copy link

amchavan commented Nov 5, 2019

Thank you Kanian.

@kanian
Copy link
Author

kanian commented Nov 18, 2019

You are welcome @amchavan

shalgrim added a commit to shalgrim/oauth-in-action-code that referenced this issue Apr 4, 2020
@BobJackson
Copy link

BobJackson commented Jul 10, 2020

if your node version is newer,for example v10.15.0, you can fix it like following:

  1. update nosql version,for example , "nosql": "^5.0.0";
  2. replace nosql.one() -> nosql.find().make(function(filter){});

This is my code:
protectedResource.js

	nosql.find().make( function(filter) {
		filter.where('access_token', '=', inToken);
		filter.callback(function (err, token) {
			if (token) {
				console.log("We found a matching token: %s", token);
				req.access_token = token[0];
			} else {
				console.log('No matching token was found.');
			}
			next();
		});
	});

@jricher
Copy link
Contributor

jricher commented Oct 13, 2020

Should be fixed by #44 .

@jricher jricher closed this as completed Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants