wulfey
wulfey3y ago

Resolving 'dynamically imported module evaluation pending, but no pending ops'

I've been getting this error quite a lot, but I haven't found a single way to know which unresolved promises cause it.
error: Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises.
Pending dynamic modules:
- file:///home/user/Desktop/js/denolasvegas/commands/main/CATEGORY.ts
error: Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises.
Pending dynamic modules:
- file:///home/user/Desktop/js/denolasvegas/commands/main/CATEGORY.ts
Any tips on what to do to find the cause of these cases?
35 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
import { CategoryInitializer } from "../../lib/commandhandler/mod.ts";
// [1] Removing the "Dummy" source initializer and any references fixes the issue
import { Dummy } from "../../lib/sources/dummy.ts";
import { TrollegleSources } from "../../trollegle.ts";

export default new CategoryInitializer<TrollegleSources>({
name: "Main",
description: "The main command category every user can use",
prefices: ["/"],
async permitted(user) {
// Check [1]
if (!(user.connection instanceof Dummy))
return await user.connection.send("no"), false;
return true;
},
});
import { CategoryInitializer } from "../../lib/commandhandler/mod.ts";
// [1] Removing the "Dummy" source initializer and any references fixes the issue
import { Dummy } from "../../lib/sources/dummy.ts";
import { TrollegleSources } from "../../trollegle.ts";

export default new CategoryInitializer<TrollegleSources>({
name: "Main",
description: "The main command category every user can use",
prefices: ["/"],
async permitted(user) {
// Check [1]
if (!(user.connection instanceof Dummy))
return await user.connection.send("no"), false;
return true;
},
});
It is worth noting the topmost contents of dummy.ts as well:
import { cli } from "../../trollegle.ts";
import CLI, { CLIEvent } from "../cli/mod.ts";
import {
CoreEvents,
BaseDummySource,
EndReason,
CoreSourceEvents,
ConnectOptions,
} from "./types.ts";

// ...
import { cli } from "../../trollegle.ts";
import CLI, { CLIEvent } from "../cli/mod.ts";
import {
CoreEvents,
BaseDummySource,
EndReason,
CoreSourceEvents,
ConnectOptions,
} from "./types.ts";

// ...
assuming that "../../trollegle.ts" is the entry file
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
8 | import { Dummy } from "./lib/sources/dummy.ts"; It imports it directly
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
Although then, weird how everything else that imports anything from [entryfile] doesnt come up with the issue
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
dummy.ts among other files regarding various initializers go before CATEGORY.ts Maybe it's not possible to import from a file that directly imports said file
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
Nope, I'd argue it might even be the last one
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
What's considered a "circular dependency"
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
That's why I wanted to ask, because I already do something similar (excluding CATEGORY.ts) which does not produce the error Okay, what about this:
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
Okay that may be useful
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
Right, but how would I do the following: have an entry file declare some useful things, such as class initializations having the entry file import (execute) other files which require importing of those useful things from the entry file Also, since these are dynamic imports, can't use deno info Okay, turns out it was because I was importing from the entry file while it had a top-level await operation hanging
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
actually its just the "await completion of method init of Trollegle<TrollegleSources>"
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
yeah
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
its basically "wait for the initializer to complete initializing a thing which initializes a thing that initializes another thing which imports the entry file" "which is waiting for the initializer to complete <ref *1>"
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
very uninformative error though also thank you, yes, i forgot to say that
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
it would be better if it were just like
error: Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises.
Pending dynamic modules:
- file:///home/user/Desktop/js/denolasvegas/commands/main/CATEGORY.ts
at file:///home/user/Desktop/js/denolasvegas/commands/main/CATEGORY.ts:2:1
at file:///home/user/Desktop/js/denolasvegas/lib/sources/dummy.ts:1:1
import { cli } from "../../trollegle.ts";
^^^^^^
Modules which are being evaluated cannot be imported from
error: Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises.
Pending dynamic modules:
- file:///home/user/Desktop/js/denolasvegas/commands/main/CATEGORY.ts
at file:///home/user/Desktop/js/denolasvegas/commands/main/CATEGORY.ts:2:1
at file:///home/user/Desktop/js/denolasvegas/lib/sources/dummy.ts:1:1
import { cli } from "../../trollegle.ts";
^^^^^^
Modules which are being evaluated cannot be imported from
like whatever the issue is, but too bad im not a deno developer
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
^
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
i doubt they'd just put a dumb error with 0 verbosity if they could make it include some information
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
wulfey
wulfeyOP3y ago
you are somewhat familiar with rust? thats neat anyways, thanks for helping out
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View