-
Notifications
You must be signed in to change notification settings - Fork 513
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
Cloudflare Workers Support - Local file header not found #434
Comments
I analyzed your zip file manually and I confirm it is invalid. The bug is due to an invalid value for the "offset of start of central directory with respect to the starting disk number" record in the "end of central directory" of the zip file, see section I've just spent some time trying to reproduce the bug in Deno, but I can't do it. I've also tried to track the assignment of this value in zip.js and so far I have no idea why it is set to Maybe setting the option |
Amazing, thanks for looking. I tried both of those options, and in both cases, I got the You can repro the issue by running the little repo I created. git clone https://github.com/baer/zip-cloudflare-repro.git
cd zip-cloudflare-repro
npm ci
npm start This will fire up Cloudflare at http://127.0.0.1:8787/, and navigating to that URL will run the code. As a control, I also created a file called node node-test.mjs
# Hello world! Is there anything else I can do to help track this down? |
Thank you for the additional info. I was able to identify some strange behaviors with typed arrays which are being emptied unexpectedly. This issue should be circumvented in the version 2.7.20 I've just published. |
First, thanks for all the work you've put into making this project complete. It's pretty cool to see this all come together on top of Web standards!
Background
I want to work with zip files in a Serverless environment. In that context, there are two options: container-based (e.g., Lambda) and Isolate-based (Cloudflare Workers, Deno, etc.). The latter group is just Chrome tabs in the cloud. Isolate-based platforms, like Zip.js, use Web standards instead of Node APIs.
Since Zip.js is based on Promise, TypedArray, and Streams, it should work out of the box for Isolate-based runtimes.
The issue
Running the
Hello World!
example from the README in Cloudflare Workers produces the error below.await firstEntry.getData(helloWorldStream.writable)
[mf:err]
is from Miniflare, Cloudflare's local runtime environment.The Repro
This is just the
Hello, World!
example from the README pasted into a Worker, but I created a minimal repro project so you could run it easily, in case that's helpful.https://github.com/baer/zip-cloudflare-repro
Things I've Looked at to Debug
Inspect the Blob as text
Download the blob as a Zip to see if macOS will have any info
Here is the file.zip it creates, and the resulting Error message
Inspect the Blob as hex
Additional Info
eval()
,new Function
, andDate.now()
Even if the fix ends up being beyond this project's scope, I thought I'd leave a few breadcrumbs in case anybody else decides to try something similar.
Thanks again for the work you do
The text was updated successfully, but these errors were encountered: