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

Crash when building with mongoose #6522

Closed
Vexcited opened this issue Oct 15, 2023 · 3 comments
Closed

Crash when building with mongoose #6522

Vexcited opened this issue Oct 15, 2023 · 3 comments
Labels
bug Something isn't working bundler Something to do with the bundler crash An issue that could cause a crash

Comments

@Vexcited
Copy link

Vexcited commented Oct 15, 2023

What version of Bun is running?

1.0.6+969da088f5db3258a803ec186012e30f992829b4

What platform is your computer?

Linux 5.10.16.3-microsoft-standard-WSL2 x86_64 unknown

What steps can reproduce the bug?

Make a new Bun project mkdir mongoose-error && cd mongoose-error && bun init (y to everything)

Install mongoose: bun add mongoose

You don't even need to start a MongoDB server, the issue is here whenever you import and use mongoose.

Inside index.ts write the following...

import mongoose from "mongoose";
mongoose; // just so the bundler understands we used it

Now bundle using bun build ./index.ts --outdir=dist --target=bun

What is the expected behavior?

Bundles in ./dist successfully

What do you see instead?

uh-oh: Internal error: missing asset file
bun will crash now 😭😭😭

----- bun meta -----
Bun v1.0.6 (969da088) Linux x64 #1 SMP Fri Apr 2 22:23:49 UTC 2021
BuildCommand:
Elapsed: 68ms | User: 178ms | Sys: 192ms
RSS: 0.20GB | Peak: 0.16GB | Commit: 0.20GB | Faults: 0
----- bun meta -----

0   0x557cab7dc6bb
1   ???
2   ???
3   ???
4   ???
5   ???
6   ???
7   ???
8   ???
9   ???
10  ???
11  ???
12  ???
13  ???

Crash report saved to:
  ~/.bun/.bun-crash/v1.0.6-1697401862950.crash

Search GitHub issues https://bun.sh/issues or ask for #help in https://bun.sh/discord

thread 28160 panic: Internal error: missing asset file
Unwind information for `:0x557caae77bf0` was not available, trace may be incomplete

[1]    28160 IOT instruction  bun build ./index.ts --outdir=dist --target=bun

Additional information

When removing mongoose from the build using --external mongoose (so bun build ./index.ts --outdir=dist --target=bun --external mongoose) it works without any issue.

The installed version is mongoose@7.6.2

Also doesn't work on mongoose@6.x but works on mongoose@5.x
image

@Vexcited Vexcited added the bug Something isn't working label Oct 15, 2023
@Electroid
Copy link
Contributor

Related #6437

@Electroid Electroid added crash An issue that could cause a crash bundler Something to do with the bundler labels Oct 16, 2023
@Jarred-Sumner
Copy link
Collaborator

Duplicate of #3903

@Jarred-Sumner Jarred-Sumner marked this as a duplicate of #3903 Dec 5, 2023
@Jarred-Sumner Jarred-Sumner closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2023
@RajaShanmugamJM
Copy link

What version of Bun is running?

1.0.6+969da088f5db3258a803ec186012e30f992829b4

What platform is your computer?

Linux 5.10.16.3-microsoft-standard-WSL2 x86_64 unknown

What steps can reproduce the bug?

Make a new Bun project mkdir mongoose-error && cd mongoose-error && bun init (y to everything)

Install mongoose: bun add mongoose

You don't even need to start a MongoDB server, the issue is here whenever you import and use mongoose.

Inside index.ts write the following...

import mongoose from "mongoose";
mongoose; // just so the bundler understands we used it

Now bundle using bun build ./index.ts --outdir=dist --target=bun

What is the expected behavior?

Bundles in ./dist successfully

What do you see instead?

uh-oh: Internal error: missing asset file
bun will crash now 😭😭😭

----- bun meta -----
Bun v1.0.6 (969da088) Linux x64 #1 SMP Fri Apr 2 22:23:49 UTC 2021
BuildCommand:
Elapsed: 68ms | User: 178ms | Sys: 192ms
RSS: 0.20GB | Peak: 0.16GB | Commit: 0.20GB | Faults: 0
----- bun meta -----

0   0x557cab7dc6bb
1   ???
2   ???
3   ???
4   ???
5   ???
6   ???
7   ???
8   ???
9   ???
10  ???
11  ???
12  ???
13  ???

Crash report saved to:
  ~/.bun/.bun-crash/v1.0.6-1697401862950.crash

Search GitHub issues https://bun.sh/issues or ask for #help in https://bun.sh/discord

thread 28160 panic: Internal error: missing asset file
Unwind information for `:0x557caae77bf0` was not available, trace may be incomplete

[1]    28160 IOT instruction  bun build ./index.ts --outdir=dist --target=bun

Additional information

When removing mongoose from the build using --external mongoose (so bun build ./index.ts --outdir=dist --target=bun --external mongoose) it works without any issue.

The installed version is mongoose@7.6.2

Also doesn't work on mongoose@6.x but works on mongoose@5.x image

adding --external flag allows to build. Tested with mongoose version ^8.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bundler Something to do with the bundler crash An issue that could cause a crash
Projects
None yet
Development

No branches or pull requests

4 participants