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

incorrect alignment when sending a FormData file #14046

Open
lmachens opened this issue Sep 19, 2024 · 0 comments
Open

incorrect alignment when sending a FormData file #14046

lmachens opened this issue Sep 19, 2024 · 0 comments
Labels
crash An issue that could cause a crash windows An issue that is known to occur on Windows

Comments

@lmachens
Copy link

lmachens commented Sep 19, 2024

How can we reproduce the crash?

It crashes for me in this function:

export async function vectorize(
  filePath: string,
  outputPath: string,
  width: number,
  height: number,
) {
  console.log("Vectorizing", filePath);
  const formData = new FormData();
  const file = Bun.file(filePath);
  formData.append("image", file);
  formData.append("output.size.width", width.toString());
  formData.append("output.size.height", height.toString());
  formData.append("output.size.unit", "px");

  const response = await fetch(
    "https://vectorizer.ai/api/v1/vectorize?mode=test",
    {
      method: "POST",
      headers: {
        Authorization: "Basic XXX",
      },
      body: formData,
    },
  );

  if (!response.ok) {
    console.error("Error:", response.status, await response.text());
    return;
  }

  const blob = await response.blob();
  return Bun.write(outputPath, blob);
}

When I remove formData.append("image", file);, it doesn't throw this error.
I am running the same function on WSL too, which works well.

Relevant log output

============================================================
Bun v1.1.28 (cf4e9cb6) Windows x64
Windows v.win10_fe
CPU: sse42 avx avx2
Args: "C:\Users\DevLeon\.bun\bin\bun.exe" "run" "stormgate.ts" "--tiles"
Features: jsc fetch tsconfig 
Builtins: "bun:main" "node:buffer" "node:fs" "node:module" "node:os" "node:path" "node:stream" "node:string_decoder" "node:url" "node:util" "node:util/types" "node:zlib" 
Elapsed: 1206ms | User: 250ms | Sys: 31ms
RSS: 0.43GB | Peak: 0.43GB | Commit: 0.60GB | Faults: 123406

panic(main thread): incorrect alignment
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

Stack Trace (bun.report)

Bun v1.1.27 (267afa2) on windows x86_64 [RunCommand]

panic: incorrect alignment

@lmachens lmachens added the crash An issue that could cause a crash label Sep 19, 2024
@github-actions github-actions bot added the windows An issue that is known to occur on Windows label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash An issue that could cause a crash windows An issue that is known to occur on Windows
Projects
None yet
Development

No branches or pull requests

1 participant