#Typegoose Issues W Bun

1 messages · Page 1 of 1 (latest)

balmy minnow
#

Im so confused right now 😭.

I have 2 bun projects on WSL2. Both of them have the exact same js code that was compiled with bun.

My issue is that I get an error on 1 of the projects but the other works perfectly!

Both have seemingly same package.json's. They do have different tsconfigs, but I dont believe that to be the issue as I transferred each tsconfig to the other project to no avail SadPepe.

The actual error im receiving is:

Operation `schemas.findOne()` buffering timed out after 10000ms

The ts code im compiling from is:

import { getModelForClass, prop } from "@typegoose/typegoose";
import { connect } from "mongoose";

await connect("mongodb://{myip}:27017/OOC-Bot?directConnection=true");

class schema {
  @prop({required: true, type: String})
  _id!: string;
}
const modelR = getModelForClass(schema);

console.log(await modelR.findOne({ _id: "rha" }));

As stated above, the code was compiled and the exact same js code is being used in both projects, yet im only getting the error on one!

package.json from working project:

{
  "name": "playground1",
  "module": "dist/index.js",
  "type": "module",
  "devDependencies": {
    "bun-types": "latest"
  },
  "peerDependencies": {
    "typescript": "^5.0.0"
  },
  "dependencies": {
    "@typegoose/typegoose": "^12.0.0",
    "@types/node": "^20.10.8",
    "mongoose": "^8.0.4"
  }
}

package.json from non working project:

{
  "name": "ooc-bot",
  "module": "src/index.ts",
  "type": "module",
  "scripts": {
    "dev": "NODE_ENV=development bun --watch run .",
    "build": "bun build .",
    "start": "NODE_ENV=production bun .",
    "test": "bun test"
  },
  "devDependencies": {
    "bun-types": "^1.0.19"
  },
  "peerDependencies": {
    "typescript": "^5.0.2"
  },
  "dependencies": {
    "@typegoose/typegoose": "^12.0.0",
    "ansi-colors": "^4.1.3",
    "discord.js": "14.13.0",
    "elysia": "^0.8.3",
    "lru-cache": "^10.1.0",
    "mongoose": "^8.0.4"
  },
  "imports": {
    "#sayings": [
      "./src/utility/templates/text/sayings.json"
    ],
    "#bot": [
      "./src/index.ts"
    ],
    "#embedBuilder": [
      "./src/utility/adapters/embedBuilder.ts"
    ]
  }
}
balmy minnow
#

Please ping me when responding

balmy minnow
#

I have even copied the exact file structure over from the non working project and package.json and yet still.... it works there but not in my main project Peepo_Eyeroll

balmy minnow
#

after copying the entire project (all files) into another dir it finally does not work and gets the same error. But after removing everything in that directory all the way down to package.json and the actual js file it still does not work!!! Im convinced its just bias to my one project at this point!!!!!

wind zealot
#

Delete the node_modules folder

#

And the bun.lockb

balmy minnow
#

I already did

#

😬

wind zealot
#

Oh

#

Whats the error

balmy minnow
#
Operation `schemas.findOne()` buffering timed out after 10000ms
#

its a mongoose error^

#

but I dont believe mongoose is the culprit

wind zealot
#

print out the NODE_ENV and make sure it's correct

balmy minnow
#

it is

wind zealot
#

I mean like

#

the entire array

balmy minnow
#

console log it

wind zealot
#

like process.env

balmy minnow
#

oh?

#

yeah

#

oh i see

#

yeah

#

1 sec

#

yeah its all right

wind zealot
#

Same on both?

balmy minnow
#

yeah

#

but im not using any env variables atm?

#

so it shouldn't matter

wind zealot
#

Did you try doing bun run index.ts rather than with .

#

.js

balmy minnow
#

Yeah im not using .

#

at all

wind zealot
#

Will it run with node?

balmy minnow
#

Im just gonna create a brand new project and slowly transfer all files across while testing along the way.

wind zealot
#

Oh elysia

balmy minnow
balmy minnow
wind zealot
#

Oh I see one is .js and the other is .ts

#

You should print out what it's transpiling the .ts to

#

I forgot how to do that but there is a way

#

I have no clue other than that

#

Since it's just that code

balmy minnow
#

wait wdmy?

#

no no, they both js code

#

im essentially got the exact same js code in 2 different directorys

wind zealot
#

If it is exactly the same like 1:1 then uh

#

I mean you could try using "npm i" instead of "bun i"

balmy minnow
#

yeah

#

lemme test

balmy minnow
#

1 works

#

1 does not

#

Ive been working on this for like 5 hours so im midly going insain

#

wtf

#

why does that work

wind zealot
#

When you used bun i the first time did it say it was building something?