Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

My lambda function is unable to unzip a file

オープン
#601 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
aws, flask, python
領域
backend, cloud

調査の方向性

file_content を /tmp/file_path に書き込む Lambda 関数から始め、Postman 経由で受信したバイト列をローカルの入力または Heroku の入力と比較します。抽出する前に、示されている zipfile.ZipFile の呼び出しで保存されたアーカイブを検証します。同じアーカイブが Lambda で正常に開かれ、抽出できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

I deployed a flask app to lambda that includes a function that unzip a small file (124ko), but nothing works as expected. The unzipping clearly fail and I can't find the reason.

2021-03-23T12:12:46.346+01:00	error [/tmp/39423ff39f7f4378a8f835a20fdcb688.zip]: missing 3183398882 bytes in zipfile

2021-03-23T12:12:46.346+01:00	(attempting to process anyway)

2021-03-23T12:12:46.346+01:00	error [/tmp/39423ff39f7f4378a8f835a20fdcb688.zip]: start of central directory not found;


2021-03-23T12:12:46.346+01:00	zipfile corrupt.

2021-03-23T12:12:46.346+01:00	(please check that you have transferred or created the zipfile in the

2021-03-23T12:12:46.346+01:00	appropriate BINARY mode and that you have compiled UnZip properly)

There is no problem when testing locally and the zip file is okay. So I guess the issue comes from lambda.

The code :

with open(file_path, "wb") as binary_file:
        binary_file.write(file_content)

Expected behavior : The file should unzip without problem just as it does when the app runs locally or in heroku.

P.S. I am using postman for testing

EDIT : also tried to extract with zipfile

with zipfile.ZipFile('/tmp/myfile.zip', 'r') as z:
    z.extractall(fil_dir)

and got the following error :

raise BadZipFile("Bad magic number for central directory")

Originally I was extracting with

os.system("unzip -qq %s -d %s" % (file_path,file_dir))

Any suggestion ?

主要言語
JavaScript
スター
11.5k
フォーク
4.4k
平均マージ
2時間 55分
マージ済み PR(30日)
3

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

serverless/examples のほかの issue

serverless/examples の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。