Eggington
Eggington4w ago

error: Top-level await promise never resolved

I have a script using typescript deno that is querying a MongoDB atlas database. When either of the collection querying methods (.find or .findOne) take too long, windmill throws this error
error: Top-level await promise never resolved
await run();
^
at <anonymous> (file:///tmp/windmill/wk-default-e2b39e03fc37-DlTlU/01938d90-f94d-cd94-9e2a-95a351ab7870/wrapper.ts:29:5)
error: Top-level await promise never resolved
await run();
^
at <anonymous> (file:///tmp/windmill/wk-default-e2b39e03fc37-DlTlU/01938d90-f94d-cd94-9e2a-95a351ab7870/wrapper.ts:29:5)
I have already investigated storing my values in smaller documents and using .find() to query all of them or saving all as one document. Neither solves this issue, which brought me back to windmill. Also, i can successfully use these methods to query running a script locally on my machine. Below is the code:
import { connectToIFSINTDatabase } from './mongodb_helpers.ts'

export async function main(key: string) {
// the key should be a string formatted as such: yyyyMMdd-OH01 where OH is 2 digit state code and 01 is workstation number
const client = await connectToIFSINTDatabase()
try {
const messagesCollection = client.database("IFSINT").collection("messages");
const messages = await messagesCollection.find({debugKey: key}).toArray()
console.log(messages)
// const all_users = await users.find({ username: { $ne: null } }).toArray();
return
} catch (error) {
console.error("Error:", error);
} finally {
await client.close();
}
}
import { connectToIFSINTDatabase } from './mongodb_helpers.ts'

export async function main(key: string) {
// the key should be a string formatted as such: yyyyMMdd-OH01 where OH is 2 digit state code and 01 is workstation number
const client = await connectToIFSINTDatabase()
try {
const messagesCollection = client.database("IFSINT").collection("messages");
const messages = await messagesCollection.find({debugKey: key}).toArray()
console.log(messages)
// const all_users = await users.find({ username: { $ne: null } }).toArray();
return
} catch (error) {
console.error("Error:", error);
} finally {
await client.close();
}
}
1 Reply
Eggington
EggingtonOP4w ago
Closed the post - i installed Deno locally and the same error occured, so i do not believe it to be a windmill issue

Did you find this page helpful?