error: Uncaught (in promise) AssertionError - mongodb

I am a new Deno learner, I tried a tutorial code that uses MongoDB but I got the following error:
error: Uncaught (in promise) AssertionError
throw new AssertionError(msg);
^
at assert (https://deno.land/std#0.107.0/testing/asserts.ts:224:11)
at MongoClient.database (https://deno.land/x/mongo#v0.27.0/src/client.ts:67:5)
at file:///C:/Users/m/Desktop/Uproject/GuidApp/deno-survey/mongo.ts:6:19
As the project has many files, Let me know if is it needed to add some parts of project codes here?
But the whole project code can be find here: https://github.com/thecodeholic/deno-survey

I found that in the mongo.ts file of the project, there is a line like this:
client.connect(Deno.env.get("MONGODB_URI") || "");
That I must add the await keyword in front of it and change it like below:
await client.connect(Deno.env.get("MONGODB_URI") || "");
Problem resolved by this.

Related

Error migrating from cannon.js to cannon-es

I have a world with cannon.js physics working fine. When I try to migrate to cannon-es I get an error in the step() function:
Uncaught TypeError: bodies[i].integrate is not a function
The step() function is:
this.physicsWorld.step(1 / 60, this.experience.time.delta, 3)
And the docs for the step() function: https://pmndrs.github.io/cannon-es/docs/classes/world.html#step
I can't find anything wrong. What does that error means?
I forgot to import cannon-es instead cannonjs in one file, so I was using a mix of two libraries.

Why am I getting "Null check operator used on a null value" from using rootBundle.load during a Flutter test?

I searched for quite a while and didn't find a clear solution to this issue on SO or other sites.
I have a Flutter test:
test('Create Repo and Read JSON', () {
Repository repository = CreateRepository();
...
}
CreateRepository() eventually calls a method with the following code:
var jsonString = await rootBundle.loadString(vendorDataFilePath);
This results in the error: Null check operator used on a null value
None of my executed code was using a null check operator (!) so where is this error coming from and how do I fix it?
After running the test in Debug mode, I found the error is actually in asset_bundle.dart within Flutter itself, not from my code.
final ByteData? asset =
await ServicesBinding.instance!.defaultBinaryMessenger.send('flutter/assets', encoded.buffer.asByteData());
It's the instance! that causes the error because instance is actually null at this point, so the null check operator (!) fails.
Unfortunately, rather than a nice descriptive error message like we normally get from Flutter, this results in a more cryptic error description directly from Dart. The root cause in my case was that an extra call is required in the test to make sure instance gets initialized.
test('Create Repo and Read JSON', () {
// Add the following line to the top of the test
TestWidgetsFlutterBinding.ensureInitialized(); // <--
Repository repository = CreateRepository();
...
}

Exception - Call to undefined function course_overviewfiles_options()

I am using a Moodle(3.2.2 the newest one) site created by php7.0 and mysql5.7,but when i try to add a new course as administrator, an error called :Exception - Call to undefined function course_overviewfiles_options(). What can i do to fix it?
I did 'Purge all caches' from Development,so the problem above disappeared,but
when users login, another error occurred: Exception - Call to undefined function core_login_get_return_url().
I did 'Purge all caches'again, the problem no.2 disappeared and the no.1 occurred again.
did you include the correct library resource file?
require_once($CFG->libdir. '/coursecatlib.php'); (I think)
HTH

Meteor error in trying to use collections

I am currently pulling data from collections in the MongoDB but there are 2 in particular that will not work either giving me the following error:
Exception from sub Assets id i574gxNDc9RdHERNn TypeError: Cannot call method 'find' of undefined
Or:
TypeError: Cannot call method 'attachSchema' of undefined
Or:
Object # has no method 'attachSchema'
depending on how I configure it. Does anyone have an idea of what I am doing wrong. I am using the same code for the ones that work as well as the ones that are throwing errors.
The collection looks like this:
Assets = Collections.Assets = Meteor.Assets;
Querying in server/publish.js:
Meteor.publish("Assets", function (){
return Meteor.Assets.find({});
});
Changing it to:
new Mongo.Collection('Assets');
Gives error:
Exception from sub Assets id ZgzZyNYPmMr5gtFGn TypeError: Cannot call method 'find' of undefined
Running the following from the command line in the top (root) directory of the project might fix this (it helped me):
meteor add aldeed:collection2

How to use webpack.config in karma.conf without duplication

I would like to require the webpack.config in karma.conf to reduce duplication. Somehow it is not working and some errors are being thrown.
Module not found: Error: a dependency to an entry point is not allowed
ERROR [karma]: Uncaught ReferenceError: webpackJsonp is not defined
the way webpack.config is required in karma.conf
var webpackConfig = require('./webpack.config');
webpackConfig.devtool = 'inline-source-map';
webpackConfig.plugins.push(new RewirePlugin());
The entry and output property of the webpack.config are not needed in karma.conf, that might be messing with the setup. How can I get rid of it?
I have tried: webpackConfig.entry = {}; which didn't succeed.
The problem could also be something else?
Would be very nice if you could point to an existing example or correct my mistake!