oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.17k stars 2.77k forks source link

Publishing lambda layer fails by "--zip-file must be a zip file with the fileb:// prefix" error #7028

Open smt7174 opened 1 year ago

smt7174 commented 1 year ago

What version of Bun is running?

1.0.8 or later(version 1.0.7 or earlier, this error does not occur)

What platform is your computer?

Linux 5.4.72-microsoft-standard-WSL2 x86_64 x86_64 and Ubuntu 18

What steps can reproduce the bug?

  1. install bun by curl -fsSL https://bun.sh/install | bash command
  2. git clone this repository by git clone https://github.com/oven-sh/bun.git or git clone git@github.com:oven-sh/bun.git command
  3. change current directory to bun/packages/bun-lambda by cd bun/packages/bun-lambda command
  4. install packages by bun install command.
  5. publish layer to your aws account by bun run publish-layer

What is the expected behavior?

publishing lambda layer finishes correctly (with no errors) like below.

$ bun scripts/publish-layer.ts
Downloading... https://bun.sh/download/latest/linux/aarch64?avx2=true
Extracting...
Saving... bun-lambda-layer.zip
Saved
Publishing...
Published <your lambda layer ARN>
Done

What do you see instead?

publishing lambda layer fails by "--zip-file must be a zip file with the fileb:// prefix" error. (error code: 252)

bun scripts/publish-layer.ts
Downloading... https://bun.sh/download/latest/linux/aarch64?avx2=true
Extracting...
Saving... bun-lambda-layer.zip
Saved
Publishing...
12 |     const result = stdout.toString("utf-8").trim();
13 |     if (status === 0) {
14 |       return result;
15 |     }
16 |     const reason = stderr.toString("utf-8").trim() || result;
17 |     throw new Error(`aws ${args.join(" ")} exited with ${status}: ${reason}`);
              ^
error: aws lambda publish-layer-version --layer-name bun --region <your aws region> --description Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager. --license-info MIT --compatible-architectures arm64 --compatible-runtimes provided.al2 provided --zip-file fileb://bun-lambda-layer.zip --output json --profile <your profile name> exited with 252: --zip-file must be a zip file with the fileb:// prefix.
Example usage:  --zip-file fileb://path/to/file.zip
      at #aws (/<your project dir>/bun-lambda/scripts/publish-layer.ts:17:10)
      at /<your project dir>/bun-lambda/scripts/publish-layer.ts:58:23
      at processTicksAndRejections (:61:76)
error: script "publish-layer" exited with code 1 (SIGHUP)

Additional information

Electroid commented 1 year ago

We may have broke something with Bun that causes a library used in the publish script to break.

smt7174 commented 1 year ago

@Electroid

We may have broke something with Bun that causes a library used in the publish script to break.

I think so. "bun" file in bun-lambda-layer.zip is 0KB, and "bootstrap" and "runtime.ts" files are not in bun-lambda-layer.zip, so aws cli may judge it's broken.

obaqueiro commented 11 months ago

I am seeing this bug in 1.0.14 in Linux

Electroid commented 11 months ago

https://github.com/oven-sh/bun/pull/7446#issuecomment-1839156919